/* BeON Box Styles */

.beon-box-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    /* Default gap */
}

.beon-box-item {
    display: flex;
    flex-direction: column !important;
    align-items: center;
    text-align: center;
    /* Force column layout, override inline styles */
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    position: relative;
    height: 100%;
    /* Ensure it fills the flex row height */
}

/* Optional card styling – add class "beon-card" in Views style settings */
.beon-card {
    border: 1px solid #eee;
    background: #fff;
    border-radius: 4px;
}

.beon-box-item.beon-card:hover {
    transform: translateY(-2px);
    z-index: 10;
}

/* Shadow variants */
.shadow-none {
    box-shadow: none;
}

.shadow-small {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.shadow-medium {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.shadow-large {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.beon-box-item:hover.shadow-small {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.beon-box-item:hover.shadow-medium {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.beon-box-item:hover.shadow-large {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* --- FIXED HEIGHT TITLE BLOCK --- */
/* Target both the wrapper class (if present) and the direct link (fallback) */
.beon-box-item .views-field-title,
.beon-box-item>a:not(:has(img)) {
    display: flex !important;
    /* Use flex to center text if needed */
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 0;
    box-sizing: border-box;
    /* Include padding in height calculation */
    line-height: 1.3;

    /* UPDATED FONT STYLES */
    font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
    /* Match heading font */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    /* Slightly reduced from 3.6px for better readability in small box */
    font-size: 1.1rem;
    /* Increased size */

    /* Calculate fixed height: (Line Height * Max Lines) + (Top Padding + Bottom Padding) */
    /* 1.3em * 3 lines = 3.9em. Plus 20px padding. */
    height: calc(1.3em * var(--beon-box-title-lines, 3) + 20px);
    min-height: calc(1.3em * var(--beon-box-title-lines, 3) + 20px);
    /* Enforce min-height too */

    overflow: hidden;
    /* Hide any overflow */
    flex-shrink: 0;
    /* Prevent flexbox from squishing it */
    flex-grow: 0;
    /* Prevent flexbox from growing it */
    margin-bottom: 0;
}

/* Title Link Styling (Line Clamping) */
.beon-box-item .views-field-title a,
.beon-box-item>a:not(:has(img)) {
    display: -webkit-box;
    -webkit-line-clamp: var(--beon-box-title-lines, 3);
    line-clamp: var(--beon-box-title-lines, 3);
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    /* Match parent weight */
    max-height: 100%;
    /* Ensure it fits within the fixed wrapper */
    text-align: center;
}

/* --- LAYOUT & POSITIONING --- */

/* Text ABOVE Image */
/* Target wrappers */
.beon-box-item.text-pos-above .views-field-title {
    order: 1;
}

.beon-box-item.text-pos-above .views-field:not(.views-field-title) {
    order: 2;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: auto;
    /* Push image to the bottom */
}

/* Target direct children (fallback) */
/* Title (First Child) */
.beon-box-item.text-pos-above>a:not(:has(img)) {
    order: 1;
}

/* Image (Second Child / Has Image) */
.beon-box-item.text-pos-above>a:has(img) {
    order: 2;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: auto;
    /* Push image to the bottom */
}


/* Text BELOW Image */
/* Target wrappers */
.beon-box-item.text-pos-below .views-field:not(.views-field-title) {
    order: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: auto;
}

.beon-box-item.text-pos-below .views-field-title {
    order: 2;
}

/* Target direct children (fallback) */
.beon-box-item.text-pos-below>a:has(img) {
    order: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: auto;
}

.beon-box-item.text-pos-below>a:not(:has(img)) {
    order: 2;
}


/* General Image Styles */
.beon-box-item img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Removed hardcoded horizontal scrolling and 260px width for kitos_serijos_fotografijos so Views UI settings work */