/* Custom CSS adapted from Torch Spatiotemporal Documentation */

/* General */

a {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Adaptive Logo for Light/Dark Theme */
.index-logo-cropped {
    content: url('../img/pyc_logo_transparent.png');
}

[data-theme="dark"] .index-logo-cropped {
    content: url('../img/pyc_logo_transparent_w.png');
}

/* Adaptive Sidebar Logo - Working solution */
.sidebar-logo-img {
    content: url('../img/pyc_logo_transparent.png') !important;
}

[data-theme="dark"] .sidebar-logo-img {
    content: url('../img/pyc_logo_transparent_w.png') !important;
}

/* Index Page Logo Cropping */
.index-logo-cropped {
    display: block;
    max-width: 40%;
    height: auto;
    margin: 0 auto;
    object-fit: cover;
    /* Crop 20% from each side using clip-path (inset: top right bottom left) */
    clip-path: inset(20% 20% 20% 20%);
    /* Scale up to compensate for the cropped area and fill the container */
    transform: scale(1.67);
    /* Ensure proper rendering */
    padding: 0;
}

/* Wrapper to contain the scaled image */
img.index-logo-cropped {
    /* Apply overflow clipping */
    overflow: hidden;
}

/* Sidebar Logo Link */
.sidebar-logo-container {
    position: sticky;
    top: 0;
    background: var(--color-sidebar-background);
    z-index: 1000;
    padding: 0.25rem 0 1rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-sidebar-background-border);
}

.sidebar-logo-link {
    display: block;
    text-align: center;
    padding: 0.25rem;
    margin: 0 auto;
    width: 100%;
    height: auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
    position: relative;
}

.sidebar-logo-link:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

.sidebar-logo-img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: cover;
    /* Crop 20% from each side using clip-path (inset: top right bottom left) */
    clip-path: inset(20% 20% 20% 20%);
    /* Scale up to compensate for the cropped area and fill the container */
    transform: scale(2.3);
}

/* Fix sidebar brand container positioning */
.sidebar-brand {
    position: relative;
    z-index: 50;
}

.sidebar-brand-text,
.sidebar-brand-container {
    position: relative;
    z-index: 50;
}

/* Fix for Furo's sidebar structure */
.sidebar-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-sticky > .sidebar-brand {
    background: var(--color-sidebar-background);
}

/* Keep logo container truly sticky at top of sidebar */
.sidebar-logo-container {
    position: sticky;
    top: 0;
    background: var(--color-sidebar-background);
    z-index: 1000;
    padding: 0.25rem 0 1rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-sidebar-background-border);
}

/* Ensure the scroll container doesn't overlap the logo */
.sidebar-scroll {
    position: relative;
    z-index: 10;
    flex: 1;
    overflow-y: auto;
}

/* Ensure navigation doesn't overlap the logo */
.sidebar-tree {
    position: relative;
    z-index: 10;
}

/* Add proper spacing and background for search container */
.sidebar-search-container {
    position: relative;
    z-index: 50;
    background: var(--color-sidebar-background);
}

/* Responsive sizing for the logo */
@media (max-width: 768px) {
    .sidebar-logo-img {
        max-width: 60px;
    }
}

@media (min-width: 1200px) {
    .sidebar-logo-img {
        max-width: 84px;
    }
}

/*  Header  */

section#torch-spatiotemporal h1 {
    display: none;
}

#particles-js {
    z-index: -30;
    position: relative;
    height: 18rem;
}

.hero-content {
    position: absolute;
    width: 65%;
    min-width: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 20px var(--color-background-primary));
    z-index: 20;
    text-align: center;
}

.hero-lead {
    font-size: 120%;
    font-weight: 300;
}

.hero-shade {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    background: linear-gradient(rgba(0, 0, 0, 0), var(--color-background-primary));
    z-index: 10;
}

.particles-js-canvas-el {
    opacity: 50%;
    position: absolute;
    width: 100%;
    height: 100%;
}

@media (max-width: 736px) {
    #particles-js {
        height: 15rem;
    }

    .hero-lead {
        font-size: 100%;
    }
}

.carousel-logo {
    background: unset;
    box-shadow: unset !important;
    border: unset !important;
    width: 50px !important;
    margin: auto;
    filter: contrast(0);
    transition-duration: 0.3s;
}

.carousel-logo:hover {
    filter: unset;
    transform: unset;
}

/* Funding Carousel */
.funding-carousel-container {
    overflow: hidden;
    width: 100%;
    padding: 2rem 0;
    background: transparent;
    position: relative;
}

.funding-carousel-track {
    display: flex;
    gap: 4rem;
    animation: scroll-logos 20s linear infinite;
    width: max-content;
}

.funding-carousel-track:hover {
    animation-play-state: paused;
}

.funding-logo-item {
    flex-shrink: 0;
    width: 180px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(100%) opacity(0.7);
    transition: all 0.3s ease;
}

.funding-logo-item:hover {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.1);
}

.funding-logo-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@keyframes scroll-logos {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .funding-logo-item {
        width: 120px;
        height: 60px;
    }

    .funding-carousel-track {
        gap: 2rem;
        animation-duration: 15s;
    }
}

/* Tables */

table.docutils {
    box-shadow: unset;
}

table.docutils caption {
    font-size: var(--font-size--normal);
    caption-side: bottom;
    margin-top: 1rem;
}

.caption-number {
    font-weight: 600;
    margin-right: 0.3rem;
}

.longtable {
    width: 100%;
}

/* Code */

code.literal {
    font-weight: 600;
}

/* Logos */

img.inline-logo {
    display: inline-block;
    width: 1.2em;
    vertical-align: text-top;
}

img.inline-logo.with-text {
    margin-right: .2em;
}

img.inline-logo.tsl {
    width: 1.3em;
}

/* GitHub contributions */

.gh-contributors {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.gh-contributor {
    width: 5rem;
    height: 5rem;
    position: relative;
    /*border: solid;*/
    /*border-radius: 50%;*/
    /*border-color: var(--color-link);*/
}

.gh-contributor img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.gh-contributor-number {
    position: absolute;
    bottom: 8px;
    right: 0;
    background: var(--color-background-primary);
    padding: 0.1rem 1rem 0.1rem .5rem;
    border-radius: 1rem 0rem 0rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Custom Card Styling */

.sd-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border-width: 1px !important;
}

.sd-card.sd-border-primary {
    border-color: rgba(59, 130, 246, 0.2) !important;
    box-shadow: 0 4px 8px -2px rgba(59, 130, 246, 0.25), 0 2px 4px -2px rgba(59, 130, 246, 0.2) !important;
}

.sd-card.sd-border-danger {
    border-color: rgba(220, 38, 38, 0.2) !important;
    box-shadow: 0 4px 8px -2px rgba(220, 38, 38, 0.25), 0 2px 4px -2px rgba(220, 38, 38, 0.2) !important;
}

.sd-card:hover {
    transform: translateY(-6px);
    border-width: 1px !important;
}

.sd-card.sd-border-primary:hover {
    box-shadow: 0 12px 20px -5px rgba(59, 130, 246, 0.35), 0 6px 10px -3px rgba(59, 130, 246, 0.3) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

.sd-card.sd-border-danger:hover {
    box-shadow: 0 12px 20px -5px rgba(220, 38, 38, 0.35), 0 6px 10px -3px rgba(220, 38, 38, 0.3) !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}

/* Remove background colors from card content */
.sd-card .sd-card-body {
    background-color: transparent !important;
}

.sd-card .sd-card-title {
    color: inherit !important;
}

.sd-card .sd-card-text {
    color: inherit !important;
}

/* Home Button in Sidebar */
.sidebar-brand-container {
    position: relative;
}

.home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: calc(100% - 1rem);
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0.5rem 1rem 0.5rem;
    background: var(--color-brand-primary);
    color: var(--color-background-primary) !important;
    text-align: center;
    text-decoration: none;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    box-sizing: border-box;
}

.home-button:hover {
    background: var(--color-brand-content);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.home-button-icon {
    width: 1.2rem;
    height: 1.2rem;
    display: inline-block;
    flex-shrink: 0;
}

/* Make logo also visually indicate it's clickable */
.sidebar-brand {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.sidebar-brand:hover {
    opacity: 0.8;
}

/* Other */

#furo-sidebar-ad-placement {
    display: none;
}