/* ===================================
   LOCAL TEAM BLOCK STYLES
   =================================== */

/* Main block container - ISOLATED to prevent conflicts */
.wp-block-acf-atax-local-team {
    background: #EDEFF5; /* Light gray background to match other blocks */
    width: 100%;
    max-width: 100vw;
}

.wp-block-acf-atax-local-team .local-team-section {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 80px 20px 40px 20px; /* Main container controls all side spacing */
    display: flex;
    flex-direction: column;
    gap: 60px;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
}

/* Main container - 1280px max-width as per design */
.local-team-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0; /* No side padding - main container controls it */
}

/* Header section with title and subtitle */
.local-team-header {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0; /* No side padding - main container controls it */
}

.local-team-main-title {
    font-size: 48px; /* Large title as per design */
    font-weight: 700; /* Bold */
    line-height: 1.2;
    color: #10A1DC; /* Accent color as per user request */
    margin: 0; /* No margin - gap handles spacing */
    font-family: 'Montserrat', sans-serif;
    word-wrap: break-word;
    hyphens: auto;
    padding: 0; /* No side padding - main container controls it */
}

.local-team-subtitle {
    font-size: 16px; /* Updated to 16px as per user request */
    font-weight: 700; /* Bold as per user request */
    line-height: 1.4;
    color: var(--primary-color, #354477); /* Primary color as per user request */
    margin: 0; /* No margin - gap handles spacing */
    font-family: 'Montserrat', sans-serif;
    word-wrap: break-word;
    padding: 0; /* No side padding - main container controls it */
}

/* Team members grid */
.local-team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 64px;
    width: 100%;
    padding: 64px 0px;
    justify-items: center;
}

/* Dynamic centering for fewer than 3 items */
.local-team-grid:has(.local-team-member:nth-child(1):last-child) {
    grid-template-columns: 1fr;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

.local-team-grid:has(.local-team-member:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

/* 2x2 layout for exactly 4 members */
.local-team-grid:has(.local-team-member:nth-child(4):last-child) {
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
}

/* JavaScript fallback classes for browsers without :has() support */
.local-team-grid.single-member {
    grid-template-columns: 1fr;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.local-team-grid.two-members {
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.local-team-grid.four-members {
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
}

/* Individual team member card */
.local-team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    background: transparent;
}

/* Team member photo */
.local-team-photo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.local-team-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Team member name */
.local-team-name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary-color, #354477);
    margin: 0 0 8px 0;
    font-family: 'Montserrat', sans-serif;
    word-wrap: break-word;
}

/* Team member position */
.local-team-position {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--primary-color, #354477);
    margin: 0 0 16px 0;
    font-family: 'Montserrat', sans-serif;
    word-wrap: break-word;
}

/* Description wrapper for read more functionality */
.local-team-description-wrapper {
    width: 100%;
    margin: 0 0 16px 0;
}

/* Team member description with 3-line clamp */
.local-team-description {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--primary-color, #354477);
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    transition: max-height 0.3s ease;
}

/* Expanded state - remove line clamp and allow full content */
.local-team-description.expanded {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
    overflow: visible;
    max-height: none !important;
}

/* Read more button */
.local-team-read-more {
    display: none; /* Hidden by default, shown via JavaScript if content exceeds 3 lines */
    background: transparent;
    border: none;
    color: #10A1DC;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    padding: 8px 0;
    margin: 8px 0 0 0;
    text-align: center;
    width: 100%;
    transition: color 0.2s ease;
    position: relative;
}

.local-team-read-more:hover {
    color: #0d7fb8;
    text-decoration: underline;
}

.local-team-read-more:focus {
    outline: none;
}

.local-team-read-more:focus-visible {
    outline: 2px solid #10A1DC;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Hide "Read Less" text by default */
.local-team-read-more .read-less-text {
    display: none;
}

/* Show "Read Less" when expanded */
.local-team-description-wrapper.expanded .local-team-read-more .read-more-text {
    display: none;
}

.local-team-description-wrapper.expanded .local-team-read-more .read-less-text {
    display: inline;
}

/* Team member languages */
.local-team-languages {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--primary-color, #354477);
    margin: 0 0 20px 0;
    font-family: 'Montserrat', sans-serif;
    word-wrap: break-word;
}

/* Team photo section (full team photo displayed below grid) */
.local-team-photo-section {
    width: 100%;
    text-align: center;
    padding: 0;
    margin-bottom: 64px;
}

.local-team-photo-image {
    max-width: 80%;
    height: auto;
    width: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 128px 0px 128px 0px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Social links container - centered single LinkedIn icon */
.local-team-social {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.local-team-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    transition: background-color 0.3s ease;
}

.local-team-social-link:hover {
    background: #dee2e6;
}

.local-team-social-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* Fallback placeholder */
.local-team-placeholder {
    text-align: center;
    padding: 32px;
    background: #f8f9fa; /* Light grey background */
    border: 2px dashed #dee2e6; /* Dashed border */
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.placeholder-icon {
    font-size: 48px;
    opacity: 0.6;
}

.placeholder-text {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--primary-color, #354477);
    margin: 0 0 16px 0;
    font-family: 'Montserrat', sans-serif;
}

.placeholder-note {
    font-size: 14px;
    color: #999;
    font-style: italic;
}

/* ===================================
   RESPONSIVE DESIGN - GLOBAL FRAMEWORK
   =================================== */

/* Laptop (1151px-1600px) - Same layout, reduced gaps only */
@media (max-width: 1600px) {
    .wp-block-acf-atax-local-team .local-team-section {
        padding: 80px 20px 40px 20px; /* Reduced top/bottom padding */
        gap: 50px; /* Reduced gap */
    }
    /* NO font size changes - same fonts as desktop */
}

/* Tablet (768px-1150px) - Layout optimization */
@media (max-width: 1150px) {
    .wp-block-acf-atax-local-team .local-team-section {
        padding: 40px 20px 40px 20px;
        gap: 45px;
    }
    .local-team-container {
        max-width: 100%;
        padding: 0; /* No side padding - main container controls it */
    }
    .local-team-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    /* Maintain centering on tablet for fewer items */
    .local-team-grid:has(.local-team-member:nth-child(1):last-child) {
        grid-template-columns: 1fr;
        justify-content: center;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .local-team-grid:has(.local-team-member:nth-child(2):last-child) {
        grid-template-columns: repeat(2, 1fr);
        justify-content: center;
        max-width: 500px;
        margin: 0 auto;
    }
    
    /* 2x2 layout for exactly 4 members on tablet */
    .local-team-grid:has(.local-team-member:nth-child(4):last-child) {
        grid-template-columns: repeat(2, 1fr);
        justify-content: center;
        max-width: 800px;
        margin: 0 auto;
    }
    
    /* JavaScript fallback for 4 members on tablet */
    .local-team-grid.four-members {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
    }
    
    /* Team photo section on tablet */
    .local-team-photo-section {
        margin-top: 50px;
    }
    /* NO font size changes - same fonts as desktop */
}

/* Mobile (0px-767px) - Stacked layout, mobile optimization */
@media (max-width: 767px) {
    .wp-block-acf-atax-local-team .local-team-section {
        padding: 40px 16px 64px 16px; /* Proper mobile padding with bottom */
        gap: 40px;
    }
    .local-team-container {
        gap: 0px; /* Scaled down for mobile */
        padding: 0; /* No side padding - main container controls it */
    }
    .local-team-main-title {
        font-size: 36px; /* 48px → 36px for mobile readability (framework exception) */
    }
    .local-team-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .local-team-photo {
        width: 100px;
        height: 100px;
        margin-bottom: 16px;
    }
    .local-team-name {
        font-size: 18px;
    }
    .local-team-position {
        font-size: 14px;
    }
    .local-team-description {
        font-size: 13px;
    }
    .local-team-languages {
        font-size: 13px;
    }
    .local-team-read-more {
        font-size: 13px;
        padding: 6px 0;
    }
    .local-team-photo-section {
        margin-top: 40px;
    }
    .local-team-photo-image {
        border-radius: 6px;
    }
    .local-team-placeholder {
        padding: 25px 20px;
        min-height: 220px;
    }
}

/* ===================================
   ALIGNMENT SUPPORT
   =================================== */

/* Wide alignment support */
.wp-block-acf-atax-local-team .local-team-section.alignwide {
    max-width: var(--wide-width, 1280px);
}

/* Full width alignment support */
.wp-block-acf-atax-local-team .local-team-section.alignfull {
    max-width: 100%;
}

/* ===================================
   OVERFLOW PROTECTION & TEXT HANDLING
   =================================== */

/* Prevent text overflow on all screen sizes */
.wp-block-acf-atax-local-team .local-team-main-title,
.wp-block-acf-atax-local-team .local-team-subtitle,
.wp-block-acf-atax-local-team .placeholder-text {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* Ensure containers don't cause horizontal scroll */
.wp-block-acf-atax-local-team .local-team-section {
    max-width: 100%;
    overflow: hidden;
}

/* Ensure grid containers don't overflow */
.wp-block-acf-atax-local-team .local-team-container {
    min-width: 0;
    overflow-x: hidden;
}
