/* =====================================================
   Xyst LinkedIn Posts — Frontend
   ===================================================== */

:root {
    --xlp-yellow:  #afab17;
    --xlp-dark:    #595a54;
    --xlp-mid:     #888983;
    --xlp-light:   #f0f0ee;
    --xlp-white:   #ffffff;
    --xlp-radius:  8px;
    --xlp-shadow:  0 1px 8px rgba(89,90,84,.10);
    --xlp-shadowh: 0 4px 20px rgba(89,90,84,.16);
    --xlp-ease:    .2s ease;
}

/* ── Section wrapper ──────────────────────────────── */
.xyst-lp-section {
    padding: 3rem 0;
}

/* ── CSS Columns grid — no gaps below short cards ─── */
.xyst-lp-grid {
    column-gap: 20px;
    margin-bottom: 28px;
}
.xyst-lp-cols-1 { columns: 1; }
.xyst-lp-cols-2 { columns: 2; }
.xyst-lp-cols-3 { columns: 3; }
.xyst-lp-cols-4 { columns: 4; }

@media (max-width: 900px) {
    .xyst-lp-cols-3,
    .xyst-lp-cols-4 { columns: 2; }
}
@media (max-width: 560px) {
    .xyst-lp-cols-1,
    .xyst-lp-cols-2,
    .xyst-lp-cols-3,
    .xyst-lp-cols-4 { columns: 1; }
}

/* ── Card ─────────────────────────────────────────── */
.xyst-lp-card {
    background: var(--xlp-white);
    border: 1px solid rgba(89,90,84,.10);
    border-radius: var(--xlp-radius);
    box-shadow: var(--xlp-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 20px;
    transition: box-shadow var(--xlp-ease), transform var(--xlp-ease);
}
.xyst-lp-card:hover {
    box-shadow: var(--xlp-shadowh);
    transform: translateY(-2px);
}

/* ── Images ───────────────────────────────────────── */
.xyst-lp-card__images {
    width: 100%;
    display: grid;
    gap: 2px;
    overflow: hidden;
    background: var(--xlp-light);
    flex-shrink: 0;
}
.xyst-lp-card__images--1 { grid-template-columns: 1fr; }
.xyst-lp-card__images--1 .xyst-lp-img { width: 100%; height: auto; display: block; }

.xyst-lp-card__images--2 { grid-template-columns: 1fr 1fr; height: 200px; }

.xyst-lp-card__images--3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 240px;
}
.xyst-lp-card__images--3 .xyst-lp-img-slot:first-child { grid-row: 1 / 3; }

.xyst-lp-card__images--4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 260px;
}

.xyst-lp-img-slot { overflow: hidden; position: relative; min-height: 0; }
.xyst-lp-card__images--1 .xyst-lp-img-slot { height: auto; }
.xyst-lp-card__images--2 .xyst-lp-img-slot,
.xyst-lp-card__images--3 .xyst-lp-img-slot,
.xyst-lp-card__images--4 .xyst-lp-img-slot { height: 100%; }

.xyst-lp-card__images--2 .xyst-lp-img,
.xyst-lp-card__images--3 .xyst-lp-img,
.xyst-lp-card__images--4 .xyst-lp-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform var(--xlp-ease);
}
.xyst-lp-card:hover .xyst-lp-img { transform: scale(1.03); }

.xyst-lp-img-slot--more::after {
    content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.45);
}
.xyst-lp-img-more {
    position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: center; color: #fff; font-size: 22px; font-weight: 700;
    z-index: 1; pointer-events: none;
}

/* ── Card body — 2rem padding ─────────────────────── */
.xyst-lp-card__body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Text — collapsed with fade, no layout shift ──── */
.xyst-lp-card__text-wrap {
    position: relative;
}
.xyst-lp-card__text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--xlp-dark);
    word-break: break-word;
    overflow: hidden;
    max-height: 120px;
}
.xyst-lp-fade {
    display: none !important; /* removed per design */
}

/* Read more — plain green text, no button chrome */
.xyst-lp-read-more {
    /* Reset ALL inherited button styles from theme */
    appearance: none !important;
    -webkit-appearance: none !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 4px 0 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--xlp-yellow) !important;
    cursor: pointer !important;
    font-family: inherit !important;
    text-align: left !important;
    display: none !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    transition: color var(--xlp-ease);
}
.xyst-lp-read-more:hover,
.xyst-lp-read-more:focus,
.xyst-lp-read-more:active {
    color: var(--xlp-dark) !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    text-decoration: underline !important;
}
.xyst-lp-card__text-wrap.has-overflow .xyst-lp-read-more { display: inline !important; }

/* Text HTML formatting */
.xyst-lp-card__text a { color: var(--xlp-yellow); text-decoration: none; }
.xyst-lp-card__text a:hover { text-decoration: underline; }
.xyst-lp-card__text .xyst-lp-hashtag { color: var(--xlp-yellow); }

/* ── Meta ─────────────────────────────────────────── */
.xyst-lp-card__meta {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding-top: 0.75rem;
    border-top: 1px solid rgba(89,90,84,.07);
}
.xyst-lp-card__date {
    font-size: 11px; font-weight: 600; letter-spacing: .05em;
    text-transform: uppercase; color: var(--xlp-yellow);
}
.xyst-lp-card__counts { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.xyst-lp-count {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--xlp-mid); font-weight: 500;
}
.xyst-lp-count svg { flex-shrink: 0; opacity: .75; }

/* ── View on LinkedIn strip ───────────────────────── */
.xyst-lp-card__link {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 10px 16px; background: var(--xlp-light);
    border-top: 1px solid rgba(89,90,84,.08);
    font-size: 12px; font-weight: 600; color: var(--xlp-yellow);
    text-decoration: none;
    transition: background var(--xlp-ease), color var(--xlp-ease);
    flex-shrink: 0;
}
.xyst-lp-card__link:hover { background: var(--xlp-yellow); color: var(--xlp-white); }

/* ── Load More ────────────────────────────────────── */
.xyst-lp-load-more-wrap { text-align: center; margin-top: 8px; }
.xyst-lp-load-more {
    background: var(--xlp-dark); color: var(--xlp-white); border: none;
    border-radius: var(--xlp-radius); padding: 11px 36px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: background var(--xlp-ease);
}
.xyst-lp-load-more:hover    { background: var(--xlp-yellow); }
.xyst-lp-load-more:disabled { opacity: .5; cursor: default; }
.xyst-lp-load-more--loading::after {
    content: ''; display: inline-block; width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
    border-radius: 50%; animation: xlpSpin .65s linear infinite;
    margin-left: 8px; vertical-align: middle;
}
@keyframes xlpSpin { to { transform: rotate(360deg); } }

.xyst-lp-empty { color: var(--xlp-mid); font-style: italic; }

/* ── Modal ────────────────────────────────────────── */
.xyst-lp-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    visibility: hidden; opacity: 0;
    transition: opacity .25s ease, visibility .25s ease;
}
.xyst-lp-modal.is-open {
    visibility: visible; opacity: 1;
}
.xyst-lp-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
    cursor: pointer;
}
.xyst-lp-modal__box {
    position: relative; z-index: 1;
    background: var(--xlp-white);
    border-radius: var(--xlp-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    width: 100%; max-width: 780px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateY(16px);
    transition: transform .25s ease;
}
.xyst-lp-modal.is-open .xyst-lp-modal__box {
    transform: translateY(0);
}
.xyst-lp-modal__close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 2 !important;
    background: rgba(0,0,0,.75) !important;
    background-color: rgba(0,0,0,.75) !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 1 !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background var(--xlp-ease) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}
.xyst-lp-modal__close:hover,
.xyst-lp-modal__close:focus,
.xyst-lp-modal__close:active {
    background: rgba(0,0,0,.95) !important;
    background-color: rgba(0,0,0,.95) !important;
    border: none !important;
    box-shadow: none !important;
    color: #fff !important;
}
.xyst-lp-modal__close svg {
    stroke: #fff !important;
    width: 14px !important;
    height: 14px !important;
    display: block !important;
}

.xyst-lp-modal__inner {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column;
}

/* Modal image */
.xyst-lp-modal__img-wrap { flex-shrink: 0; }
.xyst-lp-modal__img {
    width: 100%; max-height: 340px;
    object-fit: cover; display: block;
}

/* Modal content */
.xyst-lp-modal__content {
    padding: 2rem;
    flex: 1;
}
.xyst-lp-modal__date {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--xlp-yellow);
    margin: 0 0 1rem;
}
.xyst-lp-modal__text {
    font-size: 15px; line-height: 1.75;
    color: var(--xlp-dark); word-break: break-word;
}
.xyst-lp-modal__text a { color: var(--xlp-yellow); text-decoration: none; }
.xyst-lp-modal__text a:hover { text-decoration: underline; }
.xyst-lp-modal__text .xyst-lp-hashtag { color: var(--xlp-yellow); }

.xyst-lp-modal__link {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 1.5rem; font-size: 13px; font-weight: 600;
    color: var(--xlp-yellow); text-decoration: none;
    transition: color var(--xlp-ease);
}
.xyst-lp-modal__link:hover { color: var(--xlp-dark); text-decoration: underline; }

/* ── Mobile modal ─────────────────────────────────── */
@media (max-width: 600px) {
    .xyst-lp-modal {
        align-items: center;
        padding: 1rem;
    }
    .xyst-lp-modal__box {
        max-width: 100%;
        max-height: 88vh;
        border-radius: var(--xlp-radius);
        width: 100%;
    }
    .xyst-lp-modal__img { max-height: 200px; }
    .xyst-lp-modal__content { padding: 1.25rem; }
}

/* ── Hashtag spans (no link, just colour) ─────────── */
.xyst-lp-hashtag {
    color: var(--xlp-yellow);
    font-weight: 500;
}

/* ── Load More — green to match Read more text ────── */
.xyst-lp-load-more {
    background: transparent !important;
    color: var(--xlp-yellow) !important;
    border: 2px solid var(--xlp-yellow) !important;
    border-radius: var(--xlp-radius) !important;
    padding: 10px 36px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background var(--xlp-ease), color var(--xlp-ease) !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}
.xyst-lp-load-more:hover {
    background: var(--xlp-yellow) !important;
    color: var(--xlp-white) !important;
    border-color: var(--xlp-yellow) !important;
}
.xyst-lp-load-more:disabled {
    opacity: .5 !important;
    cursor: default !important;
}

/* Prevent SVG icons clipping */
.xyst-lp-card__link svg,
.xyst-lp-modal__link svg {
    overflow: visible !important;
    flex-shrink: 0;
}
