/* ============================================================
   HOMEPAGE REDESIGN — Hero, Pillars, Topics, Resources
   ============================================================ */

/* Brand color tokens used in this section:
   --sq-orange:     #EC6A2B  (Squirro Vibrant Orange)
   --sq-navy:       #001D32  (Squirro Ocean Navy)
   --sq-aqua:       #2FCEC3  (Squirro Aqua Breeze)
*/

/* --- Hero --- */
.sq-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #001D32 0%, #002d4e 55%, #00406e 100%);
    border-radius: 12px;
    margin: 0 0 3rem;
    padding: 3.5rem 2.5rem 3rem;
    color: #fff;
}

html[data-theme='dark'] .sq-hero {
    background: linear-gradient(135deg, #000f1a 0%, #001D32 55%, #002d4e 100%);
}

.sq-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 680px;
}

/* Decorative background shapes */
.sq-hero-shapes {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.sq-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    background: #fff;
}

.sq-shape-1 { width: 340px; height: 340px; top: -120px; right: -60px; }
.sq-shape-2 { width: 200px; height: 200px; bottom: -80px; right: 160px; }
.sq-shape-3 { width: 120px; height: 120px; top: 30px; right: 280px; opacity: 0.05; }

/* Badge / eyebrow link */
.sq-hero-eyebrow {
    margin-bottom: 1rem;
}

.sq-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 100px;
    padding: 0.25rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #e8f4fd;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* Override theme's external-link ::after arrow */
.sq-hero-badge::after { display: none; }

.sq-hero-badge:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    color: #e8f4fd;
    text-decoration: none;
}

.sq-hero-badge:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.sq-hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5dc879;
    flex-shrink: 0;
    box-shadow: 0 0 6px #5dc879;
}

/* Hero heading — scoped to .sq-hero for specificity over theme's article h1 rules */
.sq-hero .sq-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
    margin: 0 0 0.9rem;
    display: block;
}

/* Prevent the global h2/h3 underline rule from leaking in */
.sq-hero .sq-hero-title::after { display: none; }

.sq-hero-sub {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.6;
    margin: 0 0 1.75rem;
    max-width: 560px;
}

/* CTA buttons */
.sq-hero-ctas {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sq-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

/* Suppress theme external-link icon on all .sq-btn variants */
.sq-btn::after { display: none; }

/* Scoped to .sq-hero for specificity over the theme's a { color } rule */
.sq-hero .sq-btn-primary {
    background: #EC6A2B;
    color: #fff;
    border: 2px solid #EC6A2B;
}

.sq-hero .sq-btn-primary:hover,
.sq-hero .sq-btn-primary:focus {
    background: #d45a1e;
    border-color: #d45a1e;
    color: #fff;
    text-decoration: none;
}

.sq-hero .sq-btn-primary:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.sq-hero .sq-btn-ghost {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.45);
}

.sq-hero .sq-btn-ghost:hover,
.sq-hero .sq-btn-ghost:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
    text-decoration: none;
}

.sq-hero .sq-btn-ghost:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* Hide the RST-generated H1 on the homepage only.
   sq-homepage is added to <html> by custom.js; see the path-detection logic there. */
.sq-homepage article.bd-article > section > h1:first-child,
.sq-homepage article.bd-article > h1:first-child {
    display: none;
}

/* --- Section headers ---
   Using <div> instead of <h2> to avoid the global h2::after underline rule. */
.sq-section-header {
    margin-bottom: 1.25rem;
}

div.sq-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.3rem;
    line-height: 1.3;
    color: #000;
}

html[data-theme='dark'] div.sq-section-title {
    color: #fff;
}

.sq-section-sub {
    font-size: 0.95rem;
    color: var(--pst-color-muted);
    margin: 0;
}

/* --- Feature Pillars --- */
.sq-pillars {
    margin-bottom: 3rem;
}

/* sphinx-design adds high-specificity rules; !important is required here to override them */
.sq-pillar-card.sd-card {
    border-radius: 10px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sq-pillar-card.sd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.sq-pillar-card .sd-card-body {
    padding: 1.5rem;
}

/* Pillar icon badge — RST .. container:: generates a plain <div> */
div.sq-pillar-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

/* Scoped to card body for specificity over sphinx-design's icon colour rules */
.sq-pillar-card .sd-card-body .sq-pillar-icon span,
.sq-pillar-card .sd-card-body .sq-pillar-icon svg {
    color: #fff;
    fill: #fff;
}

div.sq-pillar-icon-search,
div.sq-pillar-icon-chat,
div.sq-pillar-icon-insights { background: linear-gradient(135deg, #002d4e, #001D32); }

.sq-pillar-card strong {
    font-size: 1.05rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* --- Topic Quick Links --- */
.sq-topic-grid {
    margin-bottom: 3rem;
}

.sq-topic-card.sd-card {
    border-radius: 8px;
    transition: border-color 0.15s ease;
}

.sq-topic-card.sd-card:hover {
    border-color: var(--pst-color-primary);
}

.sq-topic-card .sd-card-body {
    padding: 0.65rem 0.9rem;
}

.sq-topic-card .sd-card-body p {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Resources Grid --- */
.sq-resources-grid {
    margin-bottom: 2rem;
}

.sq-resource-card.sd-card {
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sq-resource-card.sd-card:hover {
    border-color: var(--pst-color-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.sq-resource-card .sd-card-body {
    padding: 1.2rem 1.3rem;
}

.sq-resource-card .sd-card-body p {
    font-size: 0.875rem;
    color: var(--pst-color-muted);
    margin: 0.3rem 0 0;
    line-height: 1.5;
}

.sq-resource-card .sd-card-body strong {
    font-size: 0.95rem;
}

.sq-resource-card span[class*="material-icons"] {
    color: var(--pst-color-primary);
    vertical-align: middle;
    margin-right: 0.35rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sq-hero {
        padding: 2.5rem 1.5rem 2rem;
    }

    .sq-hero .sq-hero-title {
        font-size: 1.85rem;
    }

}

@media (max-width: 576px) {
    .sq-hero .sq-hero-title {
        font-size: 1.6rem;
    }

    .sq-hero-sub {
        font-size: 1rem;
    }
}

/* ============================================================
   END HOMEPAGE REDESIGN
   ============================================================ */

/* Fix for sidebar search visibility in Chrome (SQ-31121) */
/* The theme hides .search-button-field by default, but our dynamically created button needs to be visible */

/* Base styling for dynamically created search button - high specificity without !important */
.sidebar-primary-item .search-button-field.search-button__button.js-dynamic-search {
    display: flex;
    visibility: visible;
    opacity: 1;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin: 0.5rem 0 1rem 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    text-align: left;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

/* Override theme's media query that hides search button on desktop (theme uses !important) */
@media (min-width: 992px) {
    .sidebar-primary-item .search-button-field.search-button__button.js-dynamic-search {
        display: flex !important;
    }
}

/* Ensure parent container is visible */
.sidebar-primary-item:has(.js-dynamic-search) {
    display: block;
    visibility: visible;
}

/* Light mode styling */
html[data-theme='light'] .sidebar-primary-item .search-button-field.js-dynamic-search {
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.7);
}

/* Light mode interactive states - consolidated hover/focus/active */
html[data-theme='light'] .sidebar-primary-item .search-button-field.js-dynamic-search:hover,
html[data-theme='light'] .sidebar-primary-item .search-button-field.js-dynamic-search:focus,
html[data-theme='light'] .sidebar-primary-item .search-button-field.js-dynamic-search:active {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Dark mode styling */
html[data-theme='dark'] .sidebar-primary-item .search-button-field.js-dynamic-search {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* Dark mode interactive states - consolidated hover/focus/active */
html[data-theme='dark'] .sidebar-primary-item .search-button-field.js-dynamic-search:hover,
html[data-theme='dark'] .sidebar-primary-item .search-button-field.js-dynamic-search:focus,
html[data-theme='dark'] .sidebar-primary-item .search-button-field.js-dynamic-search:active {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Remove default button outline and box-shadow for all states */
.sidebar-primary-item .search-button-field.js-dynamic-search:focus,
.sidebar-primary-item .search-button-field.js-dynamic-search:focus-visible,
.sidebar-primary-item .search-button-field.js-dynamic-search:active {
    outline: none;
    box-shadow: none;
}

/* Search icon */
.search-button-field .fa-magnifying-glass {
    margin-right: 0.5rem;
    opacity: 0.7;
    font-size: 0.875rem;
}

/* Search text */
.search-button-field .search-button__default-text {
    flex: 1;
    font-weight: 400;
    opacity: 0.8;
}

/* Hide keyboard shortcuts from all search buttons and search modal */
html[data-theme] .search-button__kbd-shortcut,
html[data-theme] .search-button-field .search-button__kbd-shortcut,
html[data-theme] .search-button__wrapper .search-button__kbd-shortcut,
html[data-theme] #pst-search-dialog .search-button__kbd-shortcut {
    display: none;
}

/* Design styles - https://sphinx-design.readthedocs.io/en/latest/css_variables.html */
html[data-theme='light'] {
    --pst-color-muted: #646464;
}

html[data-theme='dark'] {
    --pst-color-muted: #a6a6a6;
}

html[data-theme='light'],
html[data-theme='dark'] {
    --pst-color-primary: #579aca;
    --pst-color-secondary: #EC6A2B;
    --pst-color-accent: #EC6A2B;
    --pst-color-inline-code: inherit;
    --pst-color-table-row-hover-bg: inherit;
    --pst-color-table-row-zebra-low-bg: inherit;
    --pst-color-table-row-zebra-high-bg: inherit;
}

/* Logo */
.navbar-brand {
    padding: 0 18px;
}

/* GUI labels */
span.guilabel {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
}

/* Headers on home page */
.home-grid .sd-col>p,
.home-nav-list .caption {
    font-size: 20px !important;
}

/* Home Nav Cards are the quick access cards with icons on the homepage. */
.home-grid {
    padding: 0 !important;
}

.home-nav-cards {
    --sd-color-shadow: none;
}

.home-nav-cards .sd-cards {
    border-radius: 8px;
}

.home-nav-cards .sd-card-body {
    padding: 6px;
}

.home-nav-cards .sd-card p {
    font-size: 14px;
    line-height: 1.2;
    display: inline-block;
}

.home-nav-cards svg {
    color: var(--sd-color-primary);
}

/* Home Nav List is the extended navigation for all technical topics on the homepage. */
.home-nav-list {
    margin-bottom: 40px;
}

.home-nav-list div.toctree-wrapper>ul {
    margin: 0;
    padding: 0;
}

.home-nav-list .toctree-l1 {
    display: block;
    padding: 10px 24px 10px 232px;
    border: 1px solid var(--sd-color-card-border);
    border-radius: 0.25rem;
    margin-bottom: 7px;
}

.home-nav-list .toctree-l1:after {
    /* clearfix */
    content: '';
    clear: both;
    display: table;
}

.home-nav-list a {
    font-size: 14px !important;
}

.home-nav-list .toctree-l1>a {
    font-weight: 500;
    float: left;
    margin-left: -208px;
    width: 198px;
    padding-right: 10px;
}

.home-nav-list .toctree-l1 ul {
    display: inline;
    padding-left: 0;
}

.home-nav-list .toctree-l2 {
    display: inline-block;
}

.home-nav-list .toctree-l2:not(:last-child)::after {
    content: ' •';
}

.home-nav-list a,
.home-nav-list a:visited {
    color: rgba(var(--pst-color-paragraph), 1);
}

/* Inline admonition extension */
.inline_admonition {
    padding-left: 40px;
}

.inline_admonition svg {
    color: rgba(0, 0, 0, 0.54);
    margin-left: -40px;
    width: 35px;
}

.inline_warning svg {
    color: var(--sd-color-primary);
}

.inline_caution svg {
    color: #ff833a;
}

.inline_important svg {
    color: #0c8800;
}

/*
 * Styling of links.
 */
a.reference.external:not(.image-reference):after {
    font-family: Font Awesome\ 5 Free;
    font-weight: 900;
    content: '\f35d';
    font-size: 0.75em;
    margin-left: 0.3em;
}

/* ReadTheDocs switcher.
 *
 * Avoid showing the GitHub links to anonymous users. This will always hide the
 * second <dl> which for anonymous users is GitHub and for logged in users is
 * the RTD links (we don't care too much about those). */
.bd-sidebar .rst-versions.rst-badge .rst-current-version .fa-book {
    display: none;
}

.rst-versions dl:nth-child(3) {
    display: none;
}

.rst-versions .rst-other-versions>hr,
.rst-other-versions>div div:last-child {
    display: none !important;
}

/* When embedded in Academy as an iFrame */
.academy-embed main {
    margin: 20px auto;
}

/* General style improvements */
a,
nav.bd-links li>a:hover {
    text-decoration: none;
}

nav.bd-links li>a:hover {
    color: var(--pst-color-primary);
}

nav.bd-links .current>a {
    /* Hide left border on active navigation links */
    box-shadow: none;
}

h2,
h3 {
    position: relative;
    display: inline-block;
    margin-bottom: 25px;
    /* Space below the text and line */
}

h2:after,
h3:after {
    content: '';
    position: absolute;
    bottom: -10px;
    /* Position the line 10px below the text */
    left: 0;
    width: 50px;
    /* Width of the line */
    height: 3px;
    /* Thickness of the line, adjust as needed */
    background: #EC6A2B;
}

h3:after {
    background: #DBD7CF;
}

/* Search Form - Orange border styling (modal and results page) */
/* The theme may override these, so we use !important selectively where needed */

/* Consolidated border styling for both modal and results page */
.search-button__wrapper.show form.bd-search,
.bd-search-container form.bd-search,
form.bd-search {
    border: 2px solid var(--pst-color-secondary) !important;
    border-radius: 0.5rem;
}

/* Maintain orange border on focus */
.search-button__wrapper.show form.bd-search:focus-within,
.bd-search-container form.bd-search:focus-within,
form.bd-search:focus-within {
    border-color: var(--pst-color-secondary);
}

/* Remove conflicting borders and outlines from child elements */
.search-button__wrapper.show form.bd-search input,
.search-button__wrapper.show form.bd-search i,
.bd-search-container input[type="search"],
form.bd-search input[type="search"],
input[name="q"] {
    border: none;
    box-shadow: none;
    outline: none;
}

.search-button__wrapper.show form.bd-search input:focus,
.search-button__wrapper.show form.bd-search input:focus-visible {
    box-shadow: none;
    outline: none;
}

/* Remove internal borders that create separators in modal - target specific direct children only */
.search-button__wrapper.show form.bd-search > button,
.search-button__wrapper.show form.bd-search > div,
.search-button__wrapper.show form.bd-search > span {
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.image-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: #ccc;
    text-decoration: none;
}

/* Make image references clickable with pointer cursor */
a.image-reference {
    cursor: pointer;
    display: inline-block;
}
