/* Custom CSS for hypertools documentation */

/* Fix oversized title */
.document h1 {
    font-size: 2.5rem !important;
    margin-bottom: 1rem !important;
}

.document .section h1 {
    font-size: 2rem !important;
}

/* Gallery styling improvements */
.sphx-glr-thumbcontainer {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 10px;
}

.sphx-glr-thumbcontainer img {
    cursor: pointer;
    transition: opacity 0.2s;
}

.sphx-glr-thumbcontainer:hover img {
    opacity: 0.8;
}

/* Fix tooltips being cut off */
.sphx-glr-thumbcontainer[tooltip] {
    position: relative;
}

.sphx-glr-thumbcontainer[tooltip]:before {
    content: attr(tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: normal;
    max-width: 280px;
    width: max-content;
    word-wrap: break-word;
    line-height: 1.3;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

.sphx-glr-thumbcontainer[tooltip]:hover:before {
    visibility: visible;
    opacity: 1;
}

/* If tooltip would go off-screen, position it differently */
.sphx-glr-thumbcontainer[tooltip]:last-child:before,
.sphx-glr-thumbcontainer[tooltip]:nth-last-child(2):before {
    left: auto;
    right: 0;
    transform: none;
}

/* Make the entire thumbnail container clickable */
.sphx-glr-thumbcontainer {
    cursor: pointer;
}

/* Handle click events on the entire container using JavaScript */
.sphx-glr-thumbcontainer p {
    display: none; /* Hide the broken reference text */
}

/* Style the thumbnail title */
.sphx-glr-thumbnail-title {
    text-align: center;
    font-size: 14px;
    margin-top: 5px;
    color: #333;
}