/* LinkedIn Section */
.linkedin-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(60px, 8vw, 120px) 0 clamp(100px, 14vw, 200px);
    position: relative;
    overflow-x: hidden;
    max-width: 100vw;
    background:
      linear-gradient(to bottom, var(--bg-color) 0px, transparent 100px, transparent calc(100% - 100px), var(--bg-color) 100%),
      linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
      var(--bg-color);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* Typing Animation */
.typing-char {
    opacity: 0;
    transition: opacity 0.05s ease;
    display: inline-block; /* Prevent squeezing in narrow containers */
    min-width: 0.1em;
}

.typing-char.visible {
    opacity: 1;
}

.typing-cursor {
    display: inline-block;
    height: 0.85em;
    width: auto;
    vertical-align: middle;
    margin-left: 2px;
    position: relative;
    top: -2px;
    animation: cursor-blink 0.75s step-end infinite;
}

@keyframes cursor-blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* LinkedIn Header */
.linkedin-header {
    margin-bottom: clamp(30px, 4vw, 60px);
    text-align: center;
    position: relative;
    z-index: 2;
}

.linkedin-header h2 {
    font-size: clamp(26px, 2.8vw, 42px);
    margin-bottom: 16px;
}

.linkedin-header p {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 540px;
    margin: 0 auto;
}

/* LinkedIn Label */
.linkedin-label {
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.linkedin-label-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* LinkedIn Embeds Grid - 3 per row perfectly */
.linkedin-embeds {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(16px, 2vw, 28px);
    justify-content: center;
    width: 100%;
    max-width: clamp(800px, 65vw, 1200px);
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.linkedin-header {
    width: 90%;
    max-width: clamp(800px, 65vw, 1200px);
    margin: 0 auto 60px;
    padding: 0 10px;
    box-sizing: border-box;
}

@media (max-width: 600px), (max-width: 950px) and (max-height: 600px) and (orientation: landscape) {
    .linkedin-header {
        width: 100%;
        padding: 0 32px;
    }
}

/* Custom Card Container */
.linkedin-embed-card {
    /* Always 3 per row on desktop: (100% - 2 gaps) / 3 */
    flex: 0 1 calc((100% - 56px) / 3);
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s ease,
                background 0.3s ease,
                border-color 0.3s ease;
}

.linkedin-embed-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.65);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Custom Card Layout */
.custom-post-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.custom-post-image {
    width: 100%;
    height: clamp(130px, 12vw, 180px);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.linkedin-embed-card:hover .custom-post-image {
    filter: grayscale(0%);
}

/* Shift first card image to see more of the face/top */
.linkedin-embed-card:first-child .custom-post-image {
    background-position: center 20%;
}

.custom-post-content {
    padding: clamp(16px, 1.6vw, 24px);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.custom-post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.custom-post-header svg {
    fill: var(--text-main) !important;
}

.custom-post-title {
    font-size: clamp(14px, 1.2vw, 18px);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 10px;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit title to 2 lines */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.custom-post-excerpt {
    font-size: clamp(12px, 0.95vw, 14px);
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1; /* Pushes footer to bottom */
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit excerpt to 3 lines */
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.custom-post-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.custom-post-read-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    transition: color 0.2s ease;
}

.custom-post-link:hover .custom-post-read-more {
    color: #000000;
    text-decoration: underline;
}

/* CTA Wrapper */
.linkedin-cta-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    position: relative;
    z-index: 2;
}

/* CTA Button */
.linkedin-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    color: #111111;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
    background: transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.linkedin-cta-btn::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.05);
    z-index: -2;
}

.linkedin-cta-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -105%;
    width: 105%;
    height: 100%;
    background: #000000;
    transition: left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: -1;
}

.linkedin-cta-btn:hover {
    color: #FFFFFF;
    border-color: #000000;
}

.linkedin-cta-btn:hover::before {
    left: 0;
}

.linkedin-cta-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: fill 0.3s ease;
}

.linkedin-cta-btn:hover .linkedin-cta-icon {
    fill: #FFFFFF;
}

.linkedin-cta-text {
    line-height: 1;
}



@media (max-width: 680px), (max-width: 950px) and (max-height: 600px) and (orientation: landscape) {
    .linkedin-header h2 {
        font-size: 32px;
    }

    .linkedin-embeds {
        flex-direction: column;
        align-items: center;
    }

    .linkedin-embed-card {
        flex: 1 1 100%; /* 1 per row */
        width: 100%;
        max-width: min(360px, calc(100vw - 40px));
        min-width: 280px;
        margin: 0 auto;
        box-sizing: border-box;
    }
}

@media (max-width: 400px), (max-width: 950px) and (max-height: 600px) and (orientation: landscape) {
    .linkedin-header h2 {
        font-size: 20px;
    }
    .linkedin-header p {
        font-size: 14px;
    }
    .linkedin-header {
        margin-bottom: 40px;
    }
}

.typing-word {
    display: inline-block;
    white-space: nowrap;
}

/* Disable LinkedIn Card Hover on Touch */
@media (max-width: 1024px) {
    .linkedin-embed-card:hover {
        transform: none !important;
        background: rgba(255, 255, 255, 0.45) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03) !important;
    }
    .linkedin-embed-card:hover .custom-post-image {
        filter: grayscale(100%) !important;
    }
    .linkedin-cta-btn:hover {
        background: transparent !important;
        color: #111111 !important;
        border-color: rgba(0, 0, 0, 0.15) !important;
    }
    .linkedin-cta-btn:hover::before {
        left: -105% !important;
    }
}
