/* Universal box-sizing for consistency */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Work Page Styles */
.work-page {
    padding: 6rem 1rem 2rem; /* Increased top padding from 6rem to 8rem */
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Work Header */
.work-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.work-header h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

/* Work Tabs */
.work-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0 1rem;
}

.work-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    position: relative;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    color: #333;
    background: #f5f5f5;
}

.tab-btn.active {
    background: #333;
    color: white;
}

/* Work Grid - Uniform styling for all items */
.work-items {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
    justify-items: stretch !important;
    grid-auto-flow: row !important;
    width: 100% !important;
    min-width: 0 !important;
}

.work-item {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensures all items are same height */
}

/* Work Card Content */
.work-card-content {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure card content takes full height */
}

/* Caption styles */
.work-caption {
    max-width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    flex: 1; /* Make caption take available space */
}

/* Work Link */
.work-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.container {
    padding: 0rem 0.5rem;
}

/* Image container - keep fixed height */
.work-image {
    width: 100%;
    height: 300px;
    padding: 0;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 300px; /* Fixed height, prevent shrinking */
}

.work-image img,
.work-image video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-width: 100%;
    min-height: 100%;
}

.work-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
}

.work-item:hover .work-overlay {
    opacity: 1;
}

/* Title and description styles */
.work-title {
    font-size: 18px;
    font-weight: 800;
    margin-top: 16px !important;
    margin-bottom: 10px !important;
    font-family: inherit;
    color: #222;
    padding: 0;
}

.work-description {
    color: #444;
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 0.5em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    max-width: 100%;
    padding: 0;
}

/* Motion-specific styles */
.work-item.motion video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.work-item.motion .work-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* Logo items now identical to others except white background */
.work-item.logo .work-image {
    background: white; /* Maintain white bg for logos */
}

/* Add this rule to handle logo/text-based images properly */
.work-item.logo .work-image img,
.work-item.text .work-image img {
    object-fit: contain !important;
    padding: 20px;
}

/* Also add a specific class for text-based designs */
.work-item.text .work-image {
    background: #000; /* Black background for text designs */
}

/* Responsive rules */
@media (max-width: 900px) {
    .work-items {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 !important;
    }
    
    .work-page {
        padding: 7rem 0.5rem 2rem; /* Increased from 2rem to 6rem */
    }
}

@media (max-width: 600px) {
    .work-items {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 0 !important;
    }
    .work-item {
        margin-bottom: 0 !important;
        width: 100% !important;
    }
    
    .work-page {
        padding: 4rem 0 2rem; /* Increased from 2rem to 4rem */
    }
    
    .work-header {
        padding: 0 0.5rem;
    }
    
    .work-tabs {
        padding: 0 0.5rem;
    }
}

/* Portfolio items */
.portfolio-items {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
}
/* CKEditor Image Alignment Styles */
.image-style-side {
    float: right;
    margin-left: 20px;
    max-width: 50%;
}

.image-style-align-left {
    float: left;
    margin-right: 20px;
}

.image-style-align-right {
    float: right;
    margin-left: 20px;
}

.image-style-align-center {
    display: block;
    margin: 0 auto;
}

.image-style-full {
    width: 100%;
    height: auto;
}

/* Media embed responsive */
.media {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.media iframe,
.media object,
.media embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}