﻿/* Bootstrap Override - High Specificity Selectors */
#keylinks.container,
#keylinks .container,
#keylinks.container-sm,
#keylinks .container-sm,
#keylinks.container-md,
#keylinks .container-md {
    width: 100% !important;
    padding-right: 15px !important;
    padding-left: 15px !important;
    margin-right: auto !important;
    margin-left: auto !important;
}

/* Force column layouts regardless of Bootstrap */
#keylinks .row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-right: -10px !important;
    margin-left: -10px !important;
}

/* High specificity column classes to override Bootstrap */
body #keylinks .col-md-3,
html body #keylinks .col-md-3 {
    position: relative !important;
    box-sizing: border-box !important;
    padding-right: 10px !important;
    padding-left: 10px !important;
    margin-bottom: 20px !important;
}

/* 4 columns - large screens */
@media (min-width: 1200px) {
    body #keylinks .col-md-3,
    html body #keylinks .col-md-3 {
        width: 25% !important;
        max-width: 25% !important;
        flex: 0 0 25% !important;
    }
}

/* 3 columns - medium screens (including 992px) */
@media (min-width: 768px) and (max-width: 1199px) {
    body #keylinks .col-md-3,
    html body #keylinks .col-md-3 {
        width: 33.33% !important;
        max-width: 33.33% !important;
        flex: 0 0 33.33% !important;
    }
}

/* 2 columns - smaller screens */
@media (min-width: 576px) and (max-width: 767px) {
    body #keylinks .col-md-3,
    html body #keylinks .col-md-3 {
        width: 50% !important;
        max-width: 50% !important;
        flex: 0 0 50% !important;
    }
}

/* 1 column - mobile */
@media (max-width: 575px) {
    body #keylinks .col-md-3,
    html body #keylinks .col-md-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    h1 {
        font-size: 15px;
    }


}

.guide-button-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.5s ease-out, opacity 0.3s ease;
    opacity: 0;
    display: flex;
}

.guide-button-container.active {
    transform: translateX(0);
    opacity: 1;
    animation: float 4s ease-in-out infinite;
}

.guide-button-container.closing {
    opacity: 0;
    transform: translateX(400px);
}

/* Guide Button */
.guide-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white !important;
    text-decoration: none !important;
    padding: 14px 24px;
    border-radius: 12px;
    width: 290px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

    /* Force override Bootstrap a:hover */
    .guide-button:hover, .guide-button:focus, .guide-button:active {
        background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
        color: white !important;
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 8px 20px rgba(37, 99, 235, 0.6);
    }

/* Guide Button Content */
.guide-button-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

/* Guide Icon */
.guide-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.guide-button:hover .guide-icon {
    background: rgba(255, 255, 255, 0.3);
}

/* Guide Text */
.guide-text {
    display: flex;
    flex-direction: column;
}

.guide-title {
    font-weight: 600;
    font-size: 1.2rem;
}

.guide-subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* Guide Arrow */
.guide-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.guide-button:hover .guide-arrow {
    transform: translateX(6px);
}

/* Close Button */
.guide-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
    z-index: 2;
}

.guide-button-container:hover .guide-close {
    opacity: 1;
}

.guide-close:hover {
    transform: scale(1.1);
    background: #dc2626;
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .guide-button {
        width: 260px;
    }

    .guide-button-container {
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .guide-button {
        width: auto;
        padding: 10px 15px;
    }

    .guide-subtitle {
        display: none;
    }

    .guide-title {
        font-size: 1rem;
    }

    .guide-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Clear any float issues */
#keylinks .row:after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

/* Reset and base styles for the keylinks section */
#keylinks .casestudies {
    margin-bottom: 30px;
}

#keylinks h4 {
    margin-bottom: 20px;
    font-weight: 600;
}

/* Container for the keylinks */
#keylinks .keylinks-blurb-150 {
    width: 100%;
}

#keylinks .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

/* Default styling for all keylink blocks */
#keylinks .keylink-block {
    display: flex;
    height: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    transition: box-shadow 0.3s ease;
    margin-bottom: 20px;
}

    #keylinks .keylink-block:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

#keylinks .keylink {
    display: flex;
    flex-direction: row;
    width: 100%;
    text-decoration: none;
    color: inherit;
    padding: 15px;
    align-items: center;
}

#keylinks .image {
    width: 70px;
    height: 70px;
    min-width: 70px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    margin-right: 15px;
}

#keylinks .text-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

    #keylinks .text-content h2 {
        font-size: 1.1rem;
        font-weight:600;
        margin-top: 0;
        margin-bottom: 8px;
        line-height: 1.3;
    }

    #keylinks .text-content .blurb {
        font-size: 0.85rem;
        color: #666;
        line-height: 1.4;
    }

/* Very specific breakpoints for precise control */

/* 4 columns - Large desktop (1400px and above) */
@media (min-width: 1400px) {
    #keylinks .col-md-3 {
        width: 25%;
        padding: 0 10px;
        box-sizing: border-box;
    }
}

/* 4 columns - Desktop (1200px to 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    #keylinks .col-md-3 {
        width: 25%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .image {
        width: 65px;
        height: 65px;
        min-width: 65px;
    }
}

/* 3 columns - Small desktop (992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    #keylinks .col-md-3 {
        width: 33.33%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .image {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }

    #keylinks .text-content h2 {
        font-size: 1rem;
    }
}

/* 3 columns - Large tablet (901px to 991px) */
@media (min-width: 901px) and (max-width: 991px) {
    #keylinks .col-md-3 {
        width: 33.33%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .image {
        width: 55px;
        height: 55px;
        min-width: 55px;
    }

    #keylinks .text-content h2 {
        font-size: 0.95rem;
    }

    #keylinks .text-content .blurb {
        font-size: 0.8rem;
    }
}

/* 2 columns - Medium tablet (768px to 900px) */
@media (min-width: 768px) and (max-width: 900px) {
    #keylinks .col-md-3 {
        width: 50%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .image {
        width: 55px;
        height: 55px;
        min-width: 55px;
    }

    #keylinks .text-content h2 {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }
}

/* 2 columns - Small tablet (576px to 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    #keylinks .col-md-3 {
        width: 50%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .image {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }

    #keylinks .keylink {
        padding: 12px;
    }

    #keylinks .text-content h2 {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    #keylinks .text-content .blurb {
        font-size: 0.8rem;
    }
}

/* 1 column - Mobile (481px to 575px) */
@media (min-width: 481px) and (max-width: 575px) {
    #keylinks .col-md-3 {
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .keylink {
        padding: 12px;
    }

    #keylinks .image {
        width: 50px;
        height: 50px;
        min-width: 50px;
        margin-right: 12px;
    }
}

/* 1 column - Small mobile (480px and below) */
@media (max-width: 480px) {
    #keylinks .col-md-3 {
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #keylinks .keylink {
        padding: 10px;
    }

    #keylinks .image {
        width: 45px;
        height: 45px;
        min-width: 45px;
        margin-right: 10px;
    }

    #keylinks .text-content h2 {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }

    #keylinks .text-content .blurb {
        font-size: 0.75rem;
    }
}

/* Fix potential flexbox issues in IE11 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    #keylinks .row {
        display: block;
    }

    #keylinks .col-md-3 {
        float: left;
    }

    #keylinks .row:after {
        content: "";
        display: table;
        clear: both;
    }
}
