/* ==========================================================================
   OpenWeedLocator Documentation - Custom Styles for Furo Theme
   Matches branding from openweedlocator.org
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Import Quicksand Font (matches OWL website)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   2. CSS Custom Properties (Brand Colors)
   -------------------------------------------------------------------------- */
:root {
    /* Primary brand colors from openweedlocator.org */
    --owl-primary: #114ED1;
    --owl-secondary: #C1E3FF;
    --owl-accent: #2E90DE;
    --owl-dark: #204BAB;
    --owl-light: #83C7FF;

    /* Neutrals */
    --owl-text: #333333;
    --owl-bg-light: #F6F6F6;
    --owl-border: #E6E6E6;
    --owl-white: #FFFFFF;

    /* Status colors */
    --owl-success: #28a745;
    --owl-warning: #ffc107;
    --owl-error: #dc3545;
    --owl-info: #17a2b8;
}

/* --------------------------------------------------------------------------
   3. Typography - Apply Quicksand Font
   -------------------------------------------------------------------------- */
body,
.sidebar-brand-text,
.sidebar-tree,
.toc-tree {
    font-family: "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.sidebar-brand-text {
    font-family: "Quicksand", sans-serif;
    font-weight: 600;
}

/* Body text weight */
body {
    font-weight: 400;
}

/* Keep monospace for code */
code, pre, .highlight {
    font-family: "Fira Code", "SF Mono", Menlo, Consolas, monospace;
}

/* --------------------------------------------------------------------------
   4. Furo Theme Variable Overrides (Light Mode)
   -------------------------------------------------------------------------- */
body[data-theme="light"] {
    /* Brand colors */
    --color-brand-primary: var(--owl-primary);
    --color-brand-content: var(--owl-accent);

    /* Links */
    --color-link: var(--owl-primary);
    --color-link-underline: var(--owl-secondary);
    --color-link--hover: var(--owl-dark);
    --color-link-underline--hover: var(--owl-primary);

    /* Sidebar */
    --color-sidebar-brand-text: var(--owl-primary);
    --color-sidebar-link-text--top-level: var(--owl-text);
    --color-sidebar-item-background--current: var(--owl-secondary);
    --color-sidebar-item-background--hover: rgba(17, 78, 209, 0.1);

    /* Admonitions */
    --color-admonition-title-background--note: rgba(17, 78, 209, 0.1);
    --color-admonition-title-background--tip: rgba(46, 144, 222, 0.1);
    --color-admonition-title-background--important: rgba(32, 75, 171, 0.1);
    --color-admonition-title-background--warning: rgba(255, 193, 7, 0.15);
}

/* --------------------------------------------------------------------------
   5. Furo Theme Variable Overrides (Dark Mode)
   -------------------------------------------------------------------------- */
body[data-theme="dark"] {
    /* Brand colors - lighter for dark mode */
    --color-brand-primary: var(--owl-secondary);
    --color-brand-content: var(--owl-light);

    /* Links */
    --color-link: var(--owl-secondary);
    --color-link--hover: var(--owl-light);
}

/* --------------------------------------------------------------------------
   6. Admonition Styling
   -------------------------------------------------------------------------- */
.admonition {
    border-radius: 6px;
    font-family: "Quicksand", sans-serif;
}

.admonition-title {
    font-weight: 600;
}

/* Note - Primary blue */
.admonition.note {
    border-color: var(--owl-primary);
}

.admonition.note > .admonition-title {
    background-color: rgba(17, 78, 209, 0.1);
}

/* Tip - Accent blue */
.admonition.tip,
.admonition.hint {
    border-color: var(--owl-accent);
}

.admonition.tip > .admonition-title,
.admonition.hint > .admonition-title {
    background-color: rgba(46, 144, 222, 0.1);
}

/* Important - Dark blue */
.admonition.important {
    border-color: var(--owl-dark);
}

.admonition.important > .admonition-title {
    background-color: rgba(32, 75, 171, 0.1);
}

/* Warning */
.admonition.warning,
.admonition.caution,
.admonition.attention {
    border-color: var(--owl-warning);
}

.admonition.warning > .admonition-title,
.admonition.caution > .admonition-title,
.admonition.attention > .admonition-title {
    background-color: rgba(255, 193, 7, 0.15);
}

/* Error/Danger */
.admonition.error,
.admonition.danger {
    border-color: var(--owl-error);
}

.admonition.error > .admonition-title,
.admonition.danger > .admonition-title {
    background-color: rgba(220, 53, 69, 0.1);
}

/* Success */
.admonition.success {
    border-color: var(--owl-success);
}

.admonition.success > .admonition-title {
    background-color: rgba(40, 167, 69, 0.1);
}

/* See Also */
.admonition.seealso {
    border-color: var(--owl-info);
}

.admonition.seealso > .admonition-title {
    background-color: rgba(23, 162, 184, 0.1);
}

/* --------------------------------------------------------------------------
   7. Sphinx-Design Cards
   -------------------------------------------------------------------------- */
.sd-card {
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: "Quicksand", sans-serif;
}

.sd-card:hover {
    box-shadow: 0 6px 20px rgba(17, 78, 209, 0.15);
    transform: translateY(-2px);
}

/* Card border colors */
.sd-border-primary {
    border-color: var(--owl-primary) !important;
}

.sd-border-success {
    border-color: var(--owl-success) !important;
}

.sd-border-secondary {
    border-color: var(--owl-accent) !important;
}

/* Card header */
.sd-card-header {
    font-weight: 600;
    background-color: var(--owl-bg-light);
}

/* --------------------------------------------------------------------------
   8. Code Blocks
   -------------------------------------------------------------------------- */
/* Inline code */
code.literal {
    background-color: var(--owl-bg-light);
    border: 1px solid var(--owl-border);
    border-radius: 4px;
    padding: 0.1em 0.3em;
    font-size: 0.9em;
}

/* Code block styling */
.highlight {
    border-radius: 8px;
}

.highlight pre {
    border-radius: 8px;
}

/* Code block caption */
.code-block-caption {
    font-family: "Quicksand", sans-serif;
    font-weight: 500;
    background-color: var(--owl-bg-light);
    border-radius: 8px 8px 0 0;
    padding: 0.5rem 1rem;
    font-size: 0.9em;
    border: 1px solid var(--owl-border);
    border-bottom: none;
}

.code-block-caption + div.highlight pre {
    border-radius: 0 0 8px 8px;
}

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */
table {
    font-family: "Quicksand", sans-serif;
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
}

/* Table headers - use !important to override Furo defaults */
th,
.content table th,
article table th {
    background-color: var(--owl-primary) !important;
    color: #FFFFFF !important;
    font-weight: 600;
    padding: 0.75rem 1rem;
    text-align: left;
    border: none;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--owl-border);
}

tbody tr:hover {
    background-color: rgba(17, 78, 209, 0.03);
}

/* Dark mode table header */
body[data-theme="dark"] th,
body[data-theme="dark"] .content table th,
body[data-theme="dark"] article table th {
    background-color: var(--owl-dark) !important;
    color: #FFFFFF !important;
}

/* --------------------------------------------------------------------------
   10. Sidebar Enhancements
   -------------------------------------------------------------------------- */
.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Active navigation item */
.sidebar-tree .current-page > .reference {
    font-weight: 600;
    color: var(--owl-primary);
}

/* Navigation hover */
.sidebar-tree a:hover {
    color: var(--owl-primary);
}

/* --------------------------------------------------------------------------
   11. Table of Contents (Right Sidebar)
   -------------------------------------------------------------------------- */
.toc-tree a {
    font-family: "Quicksand", sans-serif;
}

.toc-tree .active > a {
    color: var(--owl-primary);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   12. Figures and Images
   -------------------------------------------------------------------------- */
figure {
    margin: 1.5rem 0;
}

figure img {
    border-radius: 8px;
    border: 1px solid var(--owl-border);
}

figcaption {
    font-family: "Quicksand", sans-serif;
    font-size: 0.9em;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   13. Mermaid Diagrams
   -------------------------------------------------------------------------- */
.mermaid {
    margin: 1.5rem 0;
    text-align: center;
}

/* --------------------------------------------------------------------------
   14. Search
   -------------------------------------------------------------------------- */
.search-button__wrapper {
    font-family: "Quicksand", sans-serif;
}

/* --------------------------------------------------------------------------
   15. Footer
   -------------------------------------------------------------------------- */
.footer {
    font-family: "Quicksand", sans-serif;
}

/* --------------------------------------------------------------------------
   16. Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .sd-card {
        margin-bottom: 1rem;
    }

    .admonition {
        padding: 0.75rem;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 0.5rem;
    }
}

/* --------------------------------------------------------------------------
   17. Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .sidebar-drawer,
    .toc-drawer {
        display: none !important;
    }

    .main {
        margin-left: 0 !important;
    }
}

/* --------------------------------------------------------------------------
   18. Content Area Tweaks
   -------------------------------------------------------------------------- */
.content {
    font-family: "Quicksand", sans-serif;
    line-height: 1.7;
}

/* List spacing */
.content ul,
.content ol {
    margin: 1rem 0;
}

.content li {
    margin: 0.5rem 0;
}

/* Paragraph spacing */
.content p {
    margin: 1rem 0;
}

/* --------------------------------------------------------------------------
   19. Abbreviation Tooltips
   -------------------------------------------------------------------------- */
abbr[title] {
    text-decoration: underline dotted rgba(17, 78, 209, 0.4);
    text-underline-offset: 3px;
    cursor: help;
    font-style: normal;
}

abbr[title]:hover {
    text-decoration: underline dotted var(--owl-primary);
}

body[data-theme="dark"] abbr[title] {
    text-decoration: underline dotted rgba(193, 227, 255, 0.4);
}

body[data-theme="dark"] abbr[title]:hover {
    text-decoration: underline dotted var(--owl-secondary);
}

/* --------------------------------------------------------------------------
   20. Embedded Dashboard Demos
   Minimal frame — iframe loads at its native viewport so the real kiosk
   layout renders correctly, then we scale it down to fit the docs column.
   -------------------------------------------------------------------------- */

/* The outer shell is an invisible scaling wrapper. It has a fixed aspect
   ratio matching the real viewport so it takes up the right vertical space,
   and `overflow: hidden` clips the scaled iframe to the shell. */
.owl-demo-shell {
    margin: 1.5rem auto;
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

/* Iframe sizing is set per-instance by owl-demo-autoscale.js on load and
   resize. The shell's aspect-ratio reserves vertical space before JS runs;
   if JS never runs the iframe renders at its CSS default (typically 300×150)
   — ugly but visible. We don't add pixel fallbacks here because they would
   just be silently overwritten by the script on every resize. */
.owl-demo-shell iframe {
    display: block;
    border: 0;
    background: #ffffff;
    transform-origin: top left;
}

.owl-demo-shell.owl-demo-tablet {
    aspect-ratio: 1280 / 800;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.22);
    border-radius: 6px;
}

.owl-demo-shell.owl-demo-phone {
    aspect-ratio: 414 / 760;
    max-width: 380px;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.22);
    border-radius: 6px;
}

/* Dark-theme shadow tweak */
body[data-theme="dark"] .owl-demo-shell {
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   21. Install terminal player (owl-term)
   Real-terminal feel — dark background, macOS-style traffic lights,
   monospace output with proper ANSI-ish colour classes.
   -------------------------------------------------------------------------- */
.owl-term {
    margin: 2rem auto;
    max-width: 820px;
}

.owl-term-frame {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #0b1020;
    box-shadow:
        0 18px 40px -18px rgba(8, 14, 32, 0.45),
        0 2px 6px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* macOS-style title bar */
.owl-term-chrome {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #252a34 0%, #1c212b 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.45);
    position: relative;
}

.owl-term-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
.owl-term-dot-r { background: #ff5f57; }
.owl-term-dot-y { background: #febc2e; }
.owl-term-dot-g { background: #28c840; }

.owl-term-title {
    position: absolute;
    left: 0; right: 0;
    text-align: center;
    font: 500 12px/1 "SF Mono", Menlo, Consolas, "Courier New", monospace;
    color: #c9d1d9;
    letter-spacing: 0.2px;
    pointer-events: none;
}

/* Terminal body */
.owl-term-body {
    margin: 0;
    padding: 14px 16px;
    background: #0b1020;
    color: #d1d9e6;
    font: 13px/1.45 "SF Mono", Menlo, Consolas, "Courier New", monospace;
    height: 460px;           /* fixed so the box never grows as content streams */
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 4;
}

.owl-term-body::-webkit-scrollbar { width: 10px; }
.owl-term-body::-webkit-scrollbar-track { background: transparent; }
.owl-term-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
}

/* Output classes — a restrained ANSI-ish palette readable on dark */
.owl-term-prompt { color: #8bd88b; font-weight: 600; }  /* green like real $ */
.owl-term-cmd    { color: #f0f4ff; font-weight: 500; }  /* bright cmd text */
.owl-term-info   { color: #60a5fa; }                    /* [INFO] — blue */
.owl-term-ok     { color: #34d399; font-weight: 600; }  /* [OK] — green */
.owl-term-warn   { color: #fbbf24; }                    /* [WARN] — amber */
.owl-term-err    { color: #f87171; font-weight: 600; }  /* [FAIL] — red */
.owl-term-muted  { color: #6b7280; }                    /* apt / pip noise */
.owl-term-plain  { color: #d1d9e6; }

/* Blinking cursor */
.owl-term-cursor {
    display: inline-block;
    width: 8px;
    background: #d1d9e6;
    vertical-align: text-bottom;
    margin-left: 1px;
    opacity: 0;
}
.owl-term-cursor-blink {
    animation: owlTermCursor 1s steps(2, end) infinite;
}
@keyframes owlTermCursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Play-button poster */
.owl-term-poster {
    position: absolute;
    inset: 36px 0 0 0;  /* below the chrome bar */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0b1020 0%, #0b1020 100%);
}
/* [hidden] must win over display: flex / inline-flex above */
.owl-term-poster[hidden],
.owl-term-btn[hidden],
.owl-term-chip[hidden] {
    display: none !important;
}

.owl-term-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(17, 78, 209, 0.9);
    color: #ffffff;
    font: 600 14px/1 "Quicksand", -apple-system, sans-serif;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
    box-shadow: 0 8px 24px -6px rgba(17, 78, 209, 0.55);
}
.owl-term-play:hover {
    background: var(--owl-primary);
    transform: translateY(-1px);
}
.owl-term-play:focus-visible {
    outline: 2px solid #9fb7ff;
    outline-offset: 2px;
}

.owl-term-play-tri {
    font-size: 14px;
    line-height: 1;
    margin-right: -2px;
}

/* Controls row */
.owl-term-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font: 500 13px/1 "Quicksand", -apple-system, sans-serif;
    flex-wrap: wrap;
}

.owl-term-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--owl-border);
    background: #ffffff;
    color: var(--owl-text);
    font: inherit;
    cursor: pointer;
    transition: background 100ms ease, border-color 100ms ease;
}
.owl-term-btn:hover {
    background: var(--owl-bg-light);
    border-color: var(--owl-accent);
    color: var(--owl-primary);
}

.owl-term-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--owl-success);
    color: white;
    font-size: 12px;
    font-weight: 600;
    animation: owlTermChip 300ms ease;
}
@keyframes owlTermChip {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

.owl-term-caption {
    margin-left: auto;
    color: var(--owl-text);
    opacity: 0.65;
    font-size: 12px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
}

/* Dark theme — keep terminal body dark (it always is), just refine outer glow
   and the controls row since the page background flips. */
body[data-theme="dark"] .owl-term-frame {
    box-shadow:
        0 18px 40px -18px rgba(131, 199, 255, 0.2),
        0 2px 6px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}
body[data-theme="dark"] .owl-term-btn {
    background: #161b22;
    color: var(--owl-light);
    border-color: rgba(255, 255, 255, 0.1);
}
body[data-theme="dark"] .owl-term-btn:hover {
    background: #1f2630;
    color: var(--owl-secondary);
    border-color: var(--owl-secondary);
}
body[data-theme="dark"] .owl-term-caption {
    color: var(--owl-secondary);
    opacity: 0.55;
}

/* Mobile */
@media (max-width: 540px) {
    .owl-term-body {
        font-size: 11.5px;
        padding: 12px;
        min-height: 320px;
    }
    .owl-term-title {
        font-size: 11px;
        left: 80px;  /* get out of the way of the dots on narrow screens */
    }
    .owl-term-caption { display: none; }
}