/* Pipeline Cards - 3 Column Grid Layout */

/* Hide only the secondary sidebar (Table of Contents "On this page") on projects page */
/* Use the presence of #pipelines-container to identify the projects page */
/* Keep the primary sidebar (navigation) visible */
#pipelines-container ~ * .md-sidebar--secondary,
body:has(#pipelines-container) .md-sidebar--secondary {
    display: none !important;
}

body:has(#pipelines-container) .md-content {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

body:has(#pipelines-container) .md-content__inner {
    max-width: 1400px;  /* Set a reasonable max-width for readability */
    margin: 0 auto;     /* Center the content */
    padding: 0 2rem;    /* Add padding on sides */
}

/* Expand content area for better grid layout */
@media (min-width: 76.25em) {
    .md-content {
        max-width: none;
        margin: 0;
    }
    
    .md-content__inner {
        max-width: 1400px;
        padding: 0 2rem;
    }
}

@media (min-width: 60em) and (max-width: 76.24em) {
    .md-content__inner {
        max-width: 1200px;
        padding: 0 1.5rem;
    }
}

@media (max-width: 59.99em) {
    .md-content__inner {
        padding: 0 1rem;
    }
}

/* Grid container - constrained within content area */
#pipelines-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

/* Responsive 3-column layout */
/* Wide desktop - can fit 4 columns with full width */
@media (min-width: 90em) {
    #pipelines-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

/* Desktop - 3 columns */
@media (min-width: 76.25em) and (max-width: 89.99em) {
    #pipelines-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Medium screens - 2 columns */
@media (min-width: 60em) and (max-width: 76.24em) {
    #pipelines-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

/* Tablet and mobile - 1 column */
@media (max-width: 59.99em) {
    #pipelines-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Pipeline Card */
.pipeline-card {
    background: var(--ocean-card, var(--md-code-bg-color));
    border: 1px solid var(--ocean-border, var(--md-default-fg-color--lightest));
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    min-width: 0; /* Prevent overflow */
    box-sizing: border-box;
    overflow: hidden; /* Prevent content overflow */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pipeline-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(5, 105, 255, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: var(--ocean-primary, var(--md-primary-fg-color--light));
}

[data-md-color-scheme="slate"] .pipeline-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-md-color-scheme="slate"] .pipeline-card:hover {
    box-shadow: 0 6px 20px rgba(5, 105, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Header */
.pipeline-header {
    margin-bottom: 0.5rem;
}

.pipeline-card h4 {
    margin: 0 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pipeline-card h4 a {
    text-decoration: none;
    color: var(--ocean-primary, var(--md-primary-fg-color));
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-weight: 600;
    transition: color 0.2s ease;
}

.pipeline-card h4 a:hover {
    color: var(--ocean-primary, var(--md-primary-fg-color));
    text-decoration: none;
    opacity: 0.85;
}

/* Description */
.pipeline-description {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    color: var(--ocean-muted-foreground, var(--md-default-fg-color--light));
    margin: 0 0 0.5rem 0 !important;
    flex-grow: 1;
}

/* Topics (now above metadata) */
.pipeline-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.topic-tag {
    background: var(--ocean-secondary, var(--md-default-fg-color--lightest));
    color: var(--ocean-secondary-foreground, var(--md-default-fg-color));
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--ocean-border, transparent);
    transition: all 0.2s ease;
}

.topic-tag:hover {
    background: var(--ocean-accent, var(--md-default-fg-color--lighter));
    transform: translateY(-1px);
}

/* Meta information (language, stars, forks) */
.pipeline-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ocean-border, var(--md-default-fg-color--lightest));
    font-size: 0.7rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--ocean-muted-foreground, var(--md-default-fg-color--light));
}

.meta-icon {
    display: inline-flex;
    align-items: center;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.meta-text {
    font-weight: 500;
    font-size: 0.7rem;
}

/* Footer */
.pipeline-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.pipeline-updated {
    font-size: 10px;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    color: var(--ocean-muted-foreground, var(--md-default-fg-color--light));
}

.pipeline-footer .md-button {
    width: 100%;
    text-align: center;
    margin: 0;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background-color: var(--ocean-primary, var(--md-primary-fg-color));
    color: var(--ocean-primary-foreground, #fff);
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pipeline-footer .md-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(5, 105, 255, 0.2);
    filter: brightness(1.1);
}

/* Loading and error states */
.loading-message,
.no-pipelines,
.error-message {
    grid-column: 1 / -1;
    padding: 2rem;
    text-align: center;
    color: var(--ocean-muted-foreground, var(--md-default-fg-color--light));
    background: var(--ocean-card, var(--md-code-bg-color));
    border: 1px solid var(--ocean-border, var(--md-default-fg-color--lightest));
    border-radius: 8px;
    margin: 2rem 0;
}

.error-message {
    border: 1px solid var(--ocean-primary, var(--md-error-fg-color));
    color: var(--ocean-primary, var(--md-error-fg-color));
    background: var(--ocean-secondary, var(--md-code-bg-color));
}

.loading-message::before {
    content: "⏳ ";
}
