/* Odoo Sync — custom theme overrides */

/* Furo's default headings are quite large; pull them down a notch */
article h1 { font-size: 1.75rem; }
article h2 { font-size: 1.5rem; }
article h3 { font-size: 1.25rem; }
article h4 { font-size: 1.125rem; }
article h5 { font-size: 1.0625rem; }
article h6 { font-size: 1rem; }

/* Headings: brand purple, matching the sidebar menu colour */
article h1, article h2, article h3,
article h4, article h5, article h6 {
    color: var(--color-brand-primary);
}

/* Center the brand block (logo + title) in the sidebar */
.sidebar-brand {
    align-items: center;
}

/* Logo — furo renders it full-width by default; cap at half the sidebar */
.sidebar-logo {
    max-width: 50%;
}

/* Tighten up the landing page hero */
.sd-card {
    border-radius: 6px !important;
}

/* Key Features grid — theme-aware background instead of sd-bg-light (which is
   always light and looks wrong in dark mode). */
.sd-card.feature-card {
    background: var(--color-background-secondary) !important;
}

/* Left border accent on code blocks */
div.highlight {
    border-left: 3px solid var(--color-brand-primary);
    border-radius: 0 4px 4px 0;
}

/* Decorator header inserted as a sibling BEFORE dt.sig by decorators.js.
   Shares the same grey background so it visually merges with dt.sig below.
   dt.sig is left completely unchanged — its hanging-indent stays intact. */
.py-decorator-header {
    background: var(--color-background-secondary);
    border-left: 3px solid var(--color-brand-primary);
    border-radius: 0.25rem 0.25rem 0 0;
    font-family: var(--font-stack--monospace);
    font-size: var(--api-font-size);
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: 0.25rem 0.5rem 0.15rem 0.5em;
    color: var(--color-foreground-secondary, var(--color-foreground-muted));
    transition: background 0.1s ease-out;
}
/* Remove top radius from dt.sig when it follows a decorator header */
dt.sig.has-decorator {
    border-radius: 0 0 0.25rem 0.25rem;
}

/* Fallback: .py-decorators block stays in <dd> when JS is disabled. */
.py-decorators {
    margin-top: 0;
    margin-bottom: 0.5rem;
}
.py-decorators div.highlight {
    border-left: none;
    border-radius: 4px;
}
.py-decorators pre {
    font-size: 0.82rem;
    padding: 0.35em 0.6em;
}

/* Subtle separator between sidebar nav sections */
.sidebar-tree .caption {
    border-top: 1px solid var(--color-background-border);
    margin-top: 0.75rem;
    padding-top: 0.5rem;
}

/* API section rubrics ("Attributes", "Methods", "CRUD", "Thread functions", …)
   Brand-coloured, with a thin separator line above.
   Selector covers rubrics both inside dl.py (class members) and at section level.
   text-transform: none overrides Furo's dd p.rubric { text-transform: uppercase }. */
article p.rubric {
    color: var(--color-brand-primary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    text-transform: none;
    margin-top: 1.0rem;
    padding-top: 0.6rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-brand-primary) 35%, var(--color-background-border));
}

/* Py domain — shared baseline for all signatures */
dt.sig {
    padding: 0.25em 0.5em;
    border-radius: 4px;
}

/* Space between consecutive method/function entries.
   Without this, undocumented entries (no <dd>) stack with no breathing room. */
dl.py.method,
dl.py.function {
    margin-bottom: 0.55rem;
}

/* Tighten the gap between a signature and its docstring body.
   Furo's default dd margin creates too much vertical space when docstrings
   are present, making documented and undocumented methods look inconsistent. */
dl.py > dd {
    margin-top: 0.2rem;
    padding-top: 0;
}

/* Methods: brand-colour left bar + tinted background — the "action" style */
dl.py.method > dt.sig,
dl.py.function > dt.sig {
    background: var(--color-background-secondary);
    border-left: 3px solid var(--color-brand-primary);
}

/* Attributes: muted teal bar + transparent background — the "data" style */
dl.py.attribute > dt.sig {
    background: transparent;
    border-left: 3px solid #5ba4a4;
}

/* Classes: slightly more prominent, no coloured bar */
dl.py.class > dt.sig {
    background: var(--color-background-secondary);
    border-left: 3px solid var(--color-background-border);
    font-weight: 600;
}

/* Field list labels (Parameters, Returns, etc.)
   Furo applies text-transform: uppercase via a deeply nested selector;
   !important is the reliable way to override it. */
dl.field-list > dt {
    text-transform: none !important;
}

/* ── Version switcher ─────────────────────────────────────────────────────── */
/* Injected by version-switcher.js between the brand title and the search box. */

.version-switcher {
    padding: 0.4rem var(--sidebar-item-spacing-horizontal, 1rem);
    border-bottom: 1px solid var(--color-background-border);
}

/* `font: inherit` is the only reliable cross-browser way to override the UA
   stylesheet for form elements (font-family alone is not enough in Chrome). */
.version-switcher__select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    font-size: var(--font-size--small);
    padding: 0.2rem 1.6rem 0.2rem 0.5rem;
    background-color: var(--color-background-secondary);
    color: var(--color-foreground-primary);
    border: 1px solid var(--color-background-border);
    border-radius: 4px;
    cursor: pointer;
    /* Neutral chevron visible in both light and dark themes */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
}

/* Tell the browser to render the native dropdown sheet in dark colours.
   Furo toggles data-theme on <body>; the media query covers auto/system mode. */
[data-theme="dark"] .version-switcher__select {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) .version-switcher__select {
        color-scheme: dark;
    }
}

.version-switcher__select:hover,
.version-switcher__select:focus {
    border-color: var(--color-brand-primary);
    outline: none;
}

/* :term: links — help cursor signals that a tooltip is available */
a[href*="glossary.html#term-"] {
    cursor: help;
}

/* ── Glossary tooltips ───────────────────────────────────────────────────── */

#glossary-tip {
    position: absolute;
    z-index: 9999;
    max-width: 320px;
    padding: 0.6rem 0.85rem;
    background: var(--color-background-primary);
    border: 1px solid var(--color-brand-primary);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    font-size: var(--font-size--small);
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}

#glossary-tip.glossary-tip--active {
    opacity: 1;
}

#glossary-tip strong {
    display: block;
    color: var(--color-brand-primary);
    margin-bottom: 0.3rem;
}

#glossary-tip p {
    margin: 0;
    color: var(--color-foreground-secondary, var(--color-foreground-muted));
}

/* ── Index / glossary filter bar ─────────────────────────────────────────── */

.index-search {
    margin-bottom: 1.5rem;
}

.index-search__input {
    width: 100%;
    max-width: 420px;
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: var(--font-size--small);
    background: var(--color-background-secondary);
    color: var(--color-foreground-primary);
    border: 1px solid var(--color-background-border);
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
}

.index-search__input:focus {
    outline: none;
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 2px rgba(135, 90, 123, 0.15);
}

/* ── Search highlight pulse ──────────────────────────────────────────────── */

@keyframes search-highlight-pulse {
    0%   { background-color: var(--color-highlighted-background);}
    25%  { background-color: #fbe54e; }
    50%  { background-color: var(--color-highlighted-background);}
    75%  { background-color: #fbe54e; }
    100% { background-color: var(--color-highlighted-background);}
}

.search-highlight-pulse {
    animation: search-highlight-pulse 1s ease-in-out;
}
