/* ==========================================================================
   OnCue Support Site — MASTER CONTENT + BLOCKS CSS
   Loaded by:
   - DSS (via src/theme/Root.js <link>)
   - Decap preview (registerPreviewStyle)
   - Streamlit preview (linked PREVIEW_CSS_URL)

   Scope:
   - Content typography (docs + previews)
   - Tables + admonitions (Decap preview generates HTML)
   - OnCue block components (.oc-*)
   ========================================================================== */


/* ==========================================================================
   0) DESIGN TOKENS / GLOBAL VARIABLES
   ========================================================================== */

:root {
    --oc-primary: #9933cc;
    --oc-border: #e5e7eb;
    --oc-text: #111;
    --oc-muted: #666;
    --oc-color-doc-title: #1C1E21;
    
    --oc-gray-bg: #e5ecef;
    --oc-radius: 10px;

    /* Internal gaps inside multi-column / grid blocks */
    --oc-gap: 30px;

    /* Content typography */
    --oc-font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, Helvetica, Arial, sans-serif;
    --oc-font-size: 14px;
    --oc-line-height: 1.4;

    /* Vertical rhythm between major blocks */
    --oc-block-space: 24px;

    --oc-two-col-gap: 24px; /* adjust as desired */

    /* Accordion styling controls */
    --oc-accordion-title-font-size: 1.2rem;
    --oc-accordion-border-color: #9933cc;
}


/* ==========================================================================
   1) CONTENT WRAPPERS + BASE TYPOGRAPHY
   - Streamlit/Decap use .preview-container
   - DSS docs use .theme-doc-markdown
   ========================================================================== */

.preview-container {
    font-family: var(--oc-font-family), serif;
    font-size: var(--oc-font-size);
    line-height: var(--oc-line-height);
    color: var(--oc-text);

    max-width: 780px;
    margin: 0 auto;
    padding: 20px;

    background: #fff;
    border: 2px solid var(--oc-border);
    border-radius: var(--oc-radius);
}

/* Apply the same baseline typography to DSS docs content */
.theme-doc-markdown {
    font-family: var(--oc-font-family), serif;
    font-size: var(--oc-font-size);
    line-height: var(--oc-line-height);
    color: var(--oc-text);
}


/* ==========================================================================
   1a) HEADINGS / PARAGRAPHS / LINKS
   ========================================================================== */

.preview-container h1,
.theme-doc-markdown h1 {
    font-size: 2.25rem;
    line-height: 1.2;
    margin: 0 0 1rem;
}

.preview-container h2,
.theme-doc-markdown h2 {
    font-size: 1.8rem;
    line-height: 1.25;
    margin: calc(var(--oc-block-space) * 1.2) 0 calc(var(--oc-block-space) * 0.5);
}

.preview-container h3,
.theme-doc-markdown h3 {
    font-size: 1.3rem;
    line-height: 1.3;
    margin: calc(var(--oc-block-space) * 1.2) 0 calc(var(--oc-block-space) * 0.5);
}

.preview-container h4,
.theme-doc-markdown h4 {
    font-size: 1.25rem;
    line-height: 1.35;
    margin: 1.25rem 0 0.625rem;
}

.preview-container p,
.theme-doc-markdown p {
    margin: 0 0 calc(var(--oc-block-space) * 1);
}

.preview-container a,
.theme-doc-markdown a {
    color: var(--oc-primary);
    text-decoration: none;
}

.preview-container a:hover,
.theme-doc-markdown a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   1b) STREAMLIT/DECAP METADATA (Preview-only)
   ========================================================================== */

.page-meta {
    color: var(--oc-muted);
    font-size: 0.9em;
    margin-bottom: 1em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--oc-border);
}

.page-meta .category {
    display: inline-block;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 6px;
    margin-right: 10px;
    font-weight: 600;
}

.page-description {
    font-style: italic;
    margin: 1em 0;
    color: #555;
}


/* ==========================================================================
   1c) LISTS
   ========================================================================== */

.preview-container ul,
.preview-container ol,
.theme-doc-markdown ul,
.theme-doc-markdown ol {
    margin: 0 0 1em;
    padding-left: 2em;
}

.preview-container li,
.theme-doc-markdown li {
    margin-bottom: 0.5em;
}

.preview-container li:last-child,
.theme-doc-markdown li:last-child {
    margin-bottom: 0;
}


/* ==========================================================================
   1d) CODE
   ========================================================================== */

.preview-container code,
.theme-doc-markdown code {
    background-color: #f6f7f8;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    padding: 0.15em 0.35em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.92em;
}

.preview-container pre,
.theme-doc-markdown pre {
    background-color: #282c34;
    color: #f8f8f2;
    border-radius: 8px;
    padding: 1em;
    overflow-x: auto;
    margin: var(--oc-block-space) 0;
}

.preview-container pre code,
.theme-doc-markdown pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
}


/* ==========================================================================
   1e) TABLES
   ========================================================================== */

.preview-container table,
.theme-doc-markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: var(--oc-block-space) 0;
}

.preview-container th,
.preview-container td,
.theme-doc-markdown th,
.theme-doc-markdown td {
    border: 1px solid var(--oc-border);
    padding: 0.75em;
    text-align: left;
}

.preview-container th,
.theme-doc-markdown th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.preview-container tr:nth-child(even),
.theme-doc-markdown tr:nth-child(even) {
    background-color: #fafbfc;
}


/* ==========================================================================
   2) ADMONITIONS
   - Docusaurus uses CSS-module classnames like .admonition_xJq3
   - We override margins to align with --oc-block-space
   ========================================================================== */

/* Override Docusaurus admonition CSS-module margins */
.theme-doc-markdown [class^="admonition_"],
.theme-doc-markdown [class*=" admonition_"],
.preview-container [class^="admonition_"],
.preview-container [class*=" admonition_"] {
    margin: var(--oc-block-space) 0 !important;
}

/* Remove extra trailing whitespace inside admonitions */
.theme-doc-markdown [class^="admonition_"] p:last-child,
.theme-doc-markdown [class*=" admonition_"] p:last-child,
.preview-container [class^="admonition_"] p:last-child,
.preview-container [class*=" admonition_"] p:last-child {
    margin-bottom: 0;
}

/* Base admonition styling (primarily for previews; DSS already has its own) */
.preview-container .admonition,
.theme-doc-markdown .admonition {
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #888;
    margin: var(--oc-block-space) 0 !important;
    background: #f8f9fa;
}

.admonition-heading {
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

/* types */
.admonition.admonition-tip {
    background: #e7f5ff;
    border-left-color: #1c7ed6;
}

.admonition.admonition-tip .admonition-heading::before {
    content: '💡 ';
}

.admonition.admonition-warning {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.admonition.admonition-warning .admonition-heading::before {
    content: '⚠️ ';
}

.admonition.admonition-note {
    background: #f8f9fa;
    border-left-color: #6c757d;
}

.admonition.admonition-note .admonition-heading::before {
    content: '📝 ';
}

.admonition.admonition-info {
    background: #d1ecf1;
    border-left-color: #0dcaf0;
}

.admonition.admonition-info .admonition-heading::before {
    content: 'ℹ️ ';
}

.admonition.admonition-caution {
    background: #fff4e6;
    border-left-color: #fd7e14;
}

.admonition.admonition-caution .admonition-heading::before {
    content: '⚡ ';
}

.admonition.admonition-danger {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.admonition.admonition-danger .admonition-heading::before {
    content: '🚨 ';
}


/* ==========================================================================
   3) ONCUE BLOCK COMPONENTS (.oc-*)
   ========================================================================== */

/* Safer: target the doc title element */
.theme-doc-markdown header h1,
.theme-doc-markdown .markdownHeader h1,
.theme-doc-markdown .theme-doc-markdown h1 {
    color: var(--oc-color-doc-title);
    font-size: 2.5rem;
    margin-top: 2rem;
    margin-bottom: 3.5rem;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, .5, 0, 0.58);
    /* styling */
}

.theme-doc-markdown table,
.preview-container table {
    margin-top: 0.5rem; /* reduce top margin */
    margin-bottom: var(--oc-block-space);
}


/* --------------------------------------------------------------------------
   3a) Common wrappers
   -------------------------------------------------------------------------- */

.oc-gray {
    background: #f4f2f1; /* (note: differs from --oc-gray-bg; keep if intentional) */
    padding: 0;
    border-radius: var(--oc-radius);
    margin: var(--oc-block-space) 0;
}


/* --------------------------------------------------------------------------
   3b) Two-column layout blocks
   -------------------------------------------------------------------------- */

.oc-two-col {
    display: flex;
    gap: var(--oc-gap);
    margin: 0;
    padding: 24px 10px;
}

.oc-two-col .oc-col-text {
    flex: 1;
    padding: 10px 10px;
}

.oc-two-col .oc-col-image {
    flex: 1;
    align-content: center;
}

.oc-img-left .oc-col-image {
    order: -1;
}

.oc-equal .oc-col-image {
    flex: 1;
}

/* --------------------------------------------------------------------------
   3c) Image Grid (up to 3 columns)
   - captions centered
   - caption position controlled by data-caption="below|above"
   -------------------------------------------------------------------------- */

.oc-image-grid {
    display: grid;
    gap: var(--oc-gap);
    margin: 0;
    padding: 24px 10px;
}

/* Column counts */
.oc-image-grid[data-cols="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.oc-image-grid[data-cols="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.oc-image-grid[data-cols="1"] {
    grid-template-columns: 1fr;
}

/* Each grid item is a vertical stack we can reorder */
.oc-image-grid-item {
    display: flex;
    flex-direction: column;
}

/* Image */
.oc-image-grid-media {
    order: 1; /* default: image first */
}

.oc-image-grid-media img {
    width: 100%;
    height: auto;
    border-radius: var(--oc-radius);
    object-fit: contain;
}

/* Caption (default: below image) */
.oc-image-grid-caption {
    order: 2;
    margin-top: 10px;
    margin-bottom: 0;
    color: #555;
    text-align: center;
}

.oc-image-grid-caption p:last-child {
    margin-bottom: 0;
}

/* If captionPosition="above" => data-caption="above" on .oc-image-grid */
.oc-image-grid[data-caption="above"] .oc-image-grid-caption {
    order: 0; /* caption above image */
    margin-top: 0;
    margin-bottom: 10px;
}

/* Responsive: collapse 3→2 on medium, 2→1 on small */
@media (max-width: 900px) {
    .oc-image-grid[data-cols="3"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .oc-image-grid[data-cols="3"],
    .oc-image-grid[data-cols="2"] {
        grid-template-columns: 1fr;
    }
}


/* --------------------------------------------------------------------------
   3d) Images (generic) + ImageBlock
   -------------------------------------------------------------------------- */

.oc-col-image img,
.oc-image-block img {
    border-radius: var(--oc-radius);
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

/*!* Single ImageBlock wrapper *!*/
/*.oc-image-block {*/
/*    margin: var(--oc-block-space) 0;*/
/*    text-align: center;*/
/*}*/

/*!* Breathing room for single-image blocks inside gray *!*/
/*.oc-gray .oc-image-block {*/
/*    padding: 24px 24px;*/
/*}*/

/*!* Ensure centered images *!*/
/*.oc-image-block img {*/
/*    display: block;*/
/*    margin: 0 auto;*/
/*}*/

/*!* ImageBlock caption (centered under image) *!*/
/*.oc-image-caption {*/
/*    margin-top: 10px;*/
/*    padding-bottom: 0;*/
/*    color: #555;*/
/*    text-align: center;*/
/*}*/

/*!* Generic caption (used by multi-image descriptions, etc.) *!*/
/*.oc-caption {*/
/*    margin-top: 10px;*/
/*    color: #555;*/
/*    text-align: left;*/
/*}*/

/**/

/* Single ImageBlock wrapper */
.oc-image-block {
    margin: var(--oc-block-space) 0;
    text-align: center;

    /* Important: this controls vertical layout inside the block */
    display: flex;
    flex-direction: column;
    justify-content: center; /* centers inner container horizontally */
}

/*.oc-image-block {*/
/*    display: block;*/
/*}*/


/* Inner container centers content and optionally constrains width */
.oc-image-inner {
    width: 100%;
    margin: 0 auto;

    /* Create a vertical layout that can distribute space */
    display: flex;
    flex-direction: column;

    /* This is the default spacing when NOT in gray */
    padding: 0;
}

/* When ImageBlock is inside gray, apply symmetric padding */
.oc-gray .oc-image-block {
    padding: 24px;
    margin: 10px 0; /* optional: reduce extra vertical margin inside gray */
}

/* Keep image centered and responsive */
.oc-image-inner img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    border-radius: calc(var(--oc-radius)*.7);
    object-fit: contain;
}

/* Caption base */
.oc-image-caption {
    color: #555;
    text-align: center;
}

/*
  Caption positioning:
  - If a caption exists, push it down so it sits in the "lower middle"
    between image and bottom padding.
  - margin-top:auto consumes remaining space in the flex column.
*/
/*.oc-image-block[data-has-caption="true"] .oc-image-caption {*/
/*    margin-top: auto; !* pushes caption toward the bottom area *!*/
/*    padding-top: 14px; !* ensures space between image and caption *!*/
/*}*/

/**/

/* Inside gray: consistent padding, no extra bottom space */
.oc-gray .oc-image-block {
    padding: 24px;
    margin: 10px 0; /* optional: prevents doubled vertical spacing inside gray */
}

/* Ensure image is centered */
.oc-image-block img {
    display: block;
    margin: 0 auto;
}

/* Caption: directly under image with a controlled gap */
.oc-image-caption {
    margin-top: 18px; /* gap between image and caption */
    margin-bottom: 0; /* no extra bottom space */
    color: #555;
    text-align: center;
}

/* If caption content includes <p>, remove default paragraph bottom margin */
.oc-image-caption p:last-child {
    margin-bottom: 0;
}


/* --------------------------------------------------------------------------
   3e) Text-only and list wrappers
   -------------------------------------------------------------------------- */

.oc-textonly,
.oc-list {
    margin: var(--oc-block-space) 0;
}


/* ==========================================================================
   4) RESPONSIVE (General)
   ========================================================================== */

@media (max-width: 768px) {
    .oc-two-col {
        flex-direction: column;
        gap: 18px;
        align-items: center;
    }
}

/* TwoColBlock: force equal 50/50 columns */
.oc-two-col.oc-two-col-50 > .oc-col-50 {
    flex: 1;
}

/* --------------------------------------------------------------------------
   TwoColBlock: table-friendly tweaks
   -------------------------------------------------------------------------- */

/* Slightly smaller tables inside side-by-side columns */
.oc-two-col.oc-two-col-50 table {
    font-size: 0.92em;
}

/* Reduce cell padding so tables fit in narrow columns */
.oc-two-col.oc-two-col-50 th,
.oc-two-col.oc-two-col-50 td {
    padding: 0.45rem 0.55rem;
}

/* Prevent long words/URLs from blowing up the column */
.oc-two-col.oc-two-col-50 th,
.oc-two-col.oc-two-col-50 td {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* If a table is still wider than its column, allow horizontal scroll */
.oc-two-col.oc-two-col-50 .table-wrapper,
.oc-two-col.oc-two-col-50 table {
    max-width: 100%;
}

.oc-two-col.oc-two-col-50 .table-wrapper {
    overflow-x: auto;
}

/* Force equal-width columns for 2-col tables inside TwoColBlock */
.oc-two-col.oc-two-col-50 table {
    table-layout: fixed;
    width: 100%;
}

.oc-two-col.oc-two-col-50 table th,
.oc-two-col.oc-two-col-50 table td {
    width: 50%;
}

.oc-two-col.oc-two-col-50 {
    gap: var(--oc-two-col-gap);
}

.oc-two-col.oc-two-col-50 > .oc-col-50 {
    flex: 1 1 0;
    min-width: 0; /* important so tables can shrink instead of overflowing */
}

.oc-two-col.oc-two-col-50 table {
    width: 100%;
    table-layout: fixed;
}

.oc-two-col.oc-two-col-50 th,
.oc-two-col.oc-two-col-50 td {
    width: 50%;
}

.theme-doc-markdown .oc-two-col.oc-two-col-50 .markdown table {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Force tables inside TwoColBlock columns to fill the column (override global table styling) */
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table,
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > .table-wrapper > table,
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table thead,
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table tbody {
    width: 100% !important;
    max-width: 100% !important;
}

.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table {
    table-layout: fixed !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0.25rem !important;
}

/* Equal-width columns */
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table th,
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table td {
    width: 50% !important;
}

/* Prevent overflow from long tokens */
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table th,
.theme-doc-markdown .oc-two-col.oc-two-col-50 .oc-col-50 > table td {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* =========================
   OnCue Accordion (details/summary)
   ========================= */

/* Remove border from collapsible content */
.collapsibleContent_i85q {
    margin-top: 0 !important;
    border-top: none !important;
}

/* Also target any details content that might use different class names */
details[open] > :not(summary) {
    border-top: none !important;
    /*margin-top: 1rem;*/
    /*padding-top: 1rem;*/
}

/* Target all possible collapsible content variations */
[class*="collapsibleContent"] {
    border-top: none !important;
}

details > div:not([class*="summary"]) {
    border-top: none !important;
}

/* --- Accordion summary: arrow on the LEFT, no default caret --- */

.oc-accordion-summary {
    list-style: none; /* Firefox */
    cursor: pointer;
    /*padding: 0.2rem 1.5rem;*/
    font-weight: 600;
    font-size: var(--oc-accordion-title-font-size);

    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start; /* left aligned */
    gap: 0.75rem;
    

    user-select: none;
}

/* Remove the default <details> marker/caret */
.oc-accordion-summary::-webkit-details-marker {
    display: none; /* Chrome/Safari */
}

.oc-accordion-summary::marker {
    content: ""; /* Firefox */
}

/* Custom "dropdown" arrow (triangle) placed at the BEGINNING */
.oc-accordion-summary::before {
    content: "";
    display: inline-block;

    width: 0;
    height: 0;

    /* triangle pointing RIGHT (collapsed) */
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 7px solid currentColor;

    opacity: 0.85;
    /*transform-origin: 50% 50%;*/
    transition: transform 160ms ease;
}

/* Rotate triangle DOWN when open */
.oc-accordion-item[open] > .oc-accordion-summary::before {
    transform: rotate(90deg);
}

/* Optional: keep the title from wrapping under the arrow oddly */
.oc-accordion-summary > * {
    min-width: 0;
}

.oc-accordion-item {
    background: #F4F2F1; /* whole item */
    border: 0px solid transparent;
}

.oc-accordion-summary {
    /*background: #eef2ff; !* header only *!*/
}

.oc-accordion-item {
    border-left: 6px solid var(--oc-accordion-border-color); /* ← change color here */
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

/*.oc-accordion details > *:not(summary) {*/
/*    border-top-color: #93c !important;*/
/*}*/

/*.oc-accordion-summary:hover {*/
/*    background: #e0e7ff; !* or comment this rule out *!*/
/*}*/

.preview-container img.oc-img-loading {
    opacity: 0.85;
}

.preview-container img.oc-img-error {
    opacity: 0.85;
}

















