/* =========================================================
   Elmax Internal Links - elementy frontendowe
   Wersja 0.4.6: wyłącznie jasna kolorystyka
   ========================================================= */

.elmax-ai-related,
.elmax-ai-related *,
.elmax-ai-card-link,
.elmax-ai-card-link *,
.elmax-ai-inline-note,
.elmax-ai-inline-note *,
.elmax-related-hub,
.elmax-related-hub * {
    box-sizing: border-box;
}

/* Pełna sekcja pojedynczego poradnika */
.elmax-ai-related {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 30px;
    margin: 24px 0 30px;
    padding: 26px 28px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #f7f8fc;
    color: #374151;
}

/* Starsze bloki z klasą --dark również stają się jasne. */
.elmax-ai-related--dark {
    border-color: #e5e7eb;
    background: #f7f8fc;
    color: #374151;
}

.elmax-ai-related__kicker {
    display: block;
    margin-bottom: 9px;
    color: #4f6df5;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .075em;
    line-height: 1.4;
    text-transform: uppercase;
}

.elmax-ai-related h3,
.elmax-ai-related--dark h3 {
    margin: 0 0 9px !important;
    color: #111827 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: -.02em !important;
    line-height: 1.3 !important;
}

.elmax-ai-related p,
.elmax-ai-related--dark p {
    margin: 0 !important;
    color: #6b7280 !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
}

.elmax-ai-related__link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 11px 17px;
    border: 1px solid rgba(79, 109, 245, .28);
    border-radius: 10px;
    background: #fff;
    color: #4f6df5 !important;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.3;
    text-align: center;
    text-decoration: none !important;
    white-space: nowrap;
    transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}

.elmax-ai-related__link:hover {
    border-color: #4f6df5;
    background: #eef1ff;
    color: #3c56d3 !important;
    transform: translateY(-2px);
}

/* Kompaktowy odnośnik wewnątrz istniejącej karty */
.elmax-ai-card-link {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 15px;
    padding: 13px 0 2px;
    border-top: 1px solid #e5e7eb;
    color: #4f6df5 !important;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.5;
    text-decoration: none !important;
    transition: color .2s ease;
}

.elmax-ai-card-link:hover {
    color: #3c56d3 !important;
}

.elmax-ai-card-link__text {
    min-width: 0;
}

.elmax-ai-card-link__arrow {
    flex: 0 0 auto;
    font-size: 17px;
    transition: transform .2s ease;
}

.elmax-ai-card-link:hover .elmax-ai-card-link__arrow {
    transform: translateX(4px);
}

/* Krótkie uzupełnienie pod akapitem */
.elmax-ai-inline-note {
    margin: 16px 0 22px !important;
    padding: 14px 17px;
    border-left: 3px solid #4f6df5;
    border-radius: 0 10px 10px 0;
    background: #f7f8fc;
    color: #4b5563 !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
}

.elmax-ai-inline-note a {
    color: #4f6df5 !important;
    font-weight: 750;
    text-decoration: none !important;
}

.elmax-ai-inline-note a:hover {
    color: #3c56d3 !important;
}

/* =========================================================
   Zarządzane sekcje powiązanych treści
   Trzy jasne i wyraźnie różne układy
   ========================================================= */

.elmax-related-hub {
    --erh-primary: #4f6df5;
    --erh-primary-dark: #3c56d3;
    --erh-primary-soft: #eef1ff;
    --erh-dark: #111827;
    --erh-text: #374151;
    --erh-muted: #6b7280;
    --erh-border: #e2e6ef;
    --erh-soft: #f7f8fc;
    --erh-white: #ffffff;

    width: 100%;
    margin: 58px 0;
    padding: 32px;
    border: 1px solid var(--erh-border);
    border-radius: 22px;
    background: var(--erh-soft);
}

.elmax-related-hub__header {
    max-width: 760px;
    margin-bottom: 25px;
    text-align: left !important;
}

.elmax-related-hub__kicker {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--erh-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .085em;
    line-height: 1.4;
    text-align: left !important;
    text-transform: uppercase;
}

.elmax-related-hub__kicker::before {
    width: 20px;
    height: 2px;
    background: currentColor;
    content: "";
}

.elmax-related-hub .elmax-related-hub__header h2 {
    margin: 0 0 10px !important;
    color: var(--erh-dark) !important;
    font-size: clamp(25px, 3.4vw, 34px) !important;
    font-weight: 740 !important;
    letter-spacing: -.03em !important;
    line-height: 1.15 !important;
    text-align: left !important;
}

.elmax-related-hub .elmax-related-hub__header p {
    margin: 0 !important;
    color: var(--erh-muted) !important;
    font-size: 15px !important;
    line-height: 1.7 !important;
    text-align: left !important;
}

.elmax-related-hub__items {
    display: grid;
    gap: 14px;
}

.elmax-related-hub__item {
    color: var(--erh-text) !important;
    text-decoration: none !important;
}

.elmax-related-hub__meta {
    display: block;
    color: var(--erh-primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .075em;
    line-height: 1.4;
    text-transform: uppercase;
}

.elmax-related-hub .elmax-related-hub__item h3 {
    color: var(--erh-dark) !important;
    font-weight: 700 !important;
    letter-spacing: -.02em !important;
}

.elmax-related-hub .elmax-related-hub__item p {
    color: var(--erh-muted) !important;
}

.elmax-related-hub__item strong {
    color: var(--erh-primary);
    font-size: 13px;
    line-height: 1.4;
}

.elmax-related-hub__item strong span {
    display: inline-block;
    transition: transform .2s ease;
}

.elmax-related-hub__item:hover strong span {
    transform: translateX(4px);
}

/* ---------------------------------------------------------
   1. Karty - równe kafle
   --------------------------------------------------------- */
.elmax-related-hub--cards .elmax-related-hub__items,
.elmax-related-hub--dark .elmax-related-hub__items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.elmax-related-hub--cards.elmax-related-hub--count-4 .elmax-related-hub__items,
.elmax-related-hub--dark.elmax-related-hub--count-4 .elmax-related-hub__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.elmax-related-hub--cards.elmax-related-hub--count-2 .elmax-related-hub__items,
.elmax-related-hub--dark.elmax-related-hub--count-2 .elmax-related-hub__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.elmax-related-hub--cards .elmax-related-hub__item,
.elmax-related-hub--dark .elmax-related-hub__item {
    display: flex;
    min-height: 245px;
    flex-direction: column;
    padding: 22px;
    border: 1px solid var(--erh-border);
    border-radius: 16px;
    background: var(--erh-white);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.elmax-related-hub--cards .elmax-related-hub__item:hover,
.elmax-related-hub--dark .elmax-related-hub__item:hover {
    border-color: rgba(79, 109, 245, .42);
    box-shadow: 0 15px 38px rgba(17, 24, 39, .07);
    transform: translateY(-3px);
}

.elmax-related-hub--cards .elmax-related-hub__meta,
.elmax-related-hub--dark .elmax-related-hub__meta {
    margin-bottom: 13px;
}

.elmax-related-hub--cards .elmax-related-hub__item h3,
.elmax-related-hub--dark .elmax-related-hub__item h3 {
    margin: 0 0 10px !important;
    font-size: 19px !important;
    line-height: 1.32 !important;
}

.elmax-related-hub--cards .elmax-related-hub__item p,
.elmax-related-hub--dark .elmax-related-hub__item p {
    margin: 0 0 18px !important;
    font-size: 13px !important;
    line-height: 1.65 !important;
}

.elmax-related-hub--cards .elmax-related-hub__item strong,
.elmax-related-hub--dark .elmax-related-hub__item strong {
    margin-top: auto;
}

.elmax-related-hub--cards .elmax-related-hub__item--landing,
.elmax-related-hub--dark .elmax-related-hub__item--landing {
    border-color: rgba(79, 109, 245, .35);
    background: var(--erh-primary-soft);
}

/* ---------------------------------------------------------
   2. Wyróżniony - duży materiał po lewej, lista po prawej
   --------------------------------------------------------- */
.elmax-related-hub--featured {
    position: relative;
    overflow: hidden;
    border-top: 4px solid var(--erh-primary);
    background: var(--erh-white);
    box-shadow: 0 18px 48px rgba(17, 24, 39, .06);
}

.elmax-related-hub--featured::after {
    position: absolute;
    top: -120px;
    right: -100px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(79, 109, 245, .07);
    content: "";
    pointer-events: none;
}

.elmax-related-hub--featured .elmax-related-hub__header,
.elmax-related-hub--featured .elmax-related-hub__items {
    position: relative;
    z-index: 1;
}

.elmax-related-hub--featured .elmax-related-hub__items {
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, .75fr);
    grid-auto-flow: row;
    gap: 12px 16px;
}

.elmax-related-hub--featured .elmax-related-hub__item {
    display: flex;
    min-height: 0;
    flex-direction: column;
    padding: 18px 20px;
    border: 1px solid var(--erh-border);
    border-radius: 14px;
    background: #fbfcff;
    transition: border-color .2s ease, background-color .2s ease;
}

.elmax-related-hub--featured .elmax-related-hub__item:hover {
    border-color: rgba(79, 109, 245, .45);
    background: var(--erh-primary-soft);
}

.elmax-related-hub--featured .elmax-related-hub__item--first {
    grid-row: 1 / span 3;
    min-height: 100%;
    justify-content: center;
    padding: 34px;
    border-color: rgba(79, 109, 245, .28);
    background:
        radial-gradient(circle at 100% 0, rgba(79, 109, 245, .17), transparent 44%),
        var(--erh-primary-soft);
}

.elmax-related-hub--featured.elmax-related-hub--count-3 .elmax-related-hub__item--first {
    grid-row: 1 / span 2;
}

.elmax-related-hub--featured.elmax-related-hub--count-2 .elmax-related-hub__item--first {
    grid-row: auto;
}

.elmax-related-hub--featured .elmax-related-hub__meta {
    margin-bottom: 9px;
}

.elmax-related-hub--featured .elmax-related-hub__item h3 {
    margin: 0 0 8px !important;
    font-size: 17px !important;
    line-height: 1.3 !important;
}

.elmax-related-hub--featured .elmax-related-hub__item--first h3 {
    font-size: clamp(23px, 2.7vw, 30px) !important;
    line-height: 1.22 !important;
}

.elmax-related-hub--featured .elmax-related-hub__item p {
    margin: 0 0 10px !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}

.elmax-related-hub--featured .elmax-related-hub__item--first p {
    font-size: 14px !important;
    line-height: 1.65 !important;
}

.elmax-related-hub--featured .elmax-related-hub__item strong {
    margin-top: auto;
}

.elmax-related-hub--featured .elmax-related-hub__item--landing:not(.elmax-related-hub__item--first) {
    border-style: dashed;
}

/* ---------------------------------------------------------
   3. Lista redakcyjna - numerowane wiersze bez kart
   --------------------------------------------------------- */
.elmax-related-hub--editorial {
    padding: 34px 38px;
    border-left: 5px solid var(--erh-primary);
    border-radius: 4px 20px 20px 4px;
    background: var(--erh-white);
}

.elmax-related-hub--editorial .elmax-related-hub__header {
    display: grid;
    max-width: none;
    grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr);
    align-items: end;
    column-gap: 42px;
}

.elmax-related-hub--editorial .elmax-related-hub__header .elmax-related-hub__kicker,
.elmax-related-hub--editorial .elmax-related-hub__header h2 {
    grid-column: 1;
}

.elmax-related-hub--editorial .elmax-related-hub__header p {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.elmax-related-hub--editorial .elmax-related-hub__items {
    grid-template-columns: 1fr;
    gap: 0;
    border-bottom: 1px solid var(--erh-border);
    counter-reset: elmax-related-item;
}

.elmax-related-hub--editorial .elmax-related-hub__item {
    position: relative;
    display: grid;
    min-height: 0;
    grid-template-columns: 54px minmax(180px, .85fr) minmax(220px, 1.15fr) auto;
    align-items: center;
    gap: 18px;
    padding: 19px 8px;
    border-top: 1px solid var(--erh-border);
    counter-increment: elmax-related-item;
    transition: background-color .2s ease;
}

.elmax-related-hub--editorial .elmax-related-hub__item::before {
    color: var(--erh-primary);
    content: counter(elmax-related-item, decimal-leading-zero);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
}

.elmax-related-hub--editorial .elmax-related-hub__item:hover {
    background: var(--erh-soft);
}

.elmax-related-hub--editorial .elmax-related-hub__meta {
    display: none;
}

.elmax-related-hub--editorial .elmax-related-hub__item h3 {
    margin: 0 !important;
    font-size: 17px !important;
    line-height: 1.32 !important;
}

.elmax-related-hub--editorial .elmax-related-hub__item p {
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}

.elmax-related-hub--editorial .elmax-related-hub__item strong {
    white-space: nowrap;
}

.elmax-related-hub--editorial .elmax-related-hub__item--landing {
    background: rgba(79, 109, 245, .045);
}

@media (max-width: 900px) {
    .elmax-related-hub--cards .elmax-related-hub__items,
    .elmax-related-hub--cards.elmax-related-hub--count-4 .elmax-related-hub__items,
    .elmax-related-hub--dark .elmax-related-hub__items,
    .elmax-related-hub--featured .elmax-related-hub__items {
        grid-template-columns: 1fr;
    }

    .elmax-related-hub--featured .elmax-related-hub__item--first,
    .elmax-related-hub--featured.elmax-related-hub--count-3 .elmax-related-hub__item--first {
        grid-row: auto;
    }

    .elmax-related-hub--editorial .elmax-related-hub__header {
        display: block;
    }

    .elmax-related-hub--editorial .elmax-related-hub__item {
        grid-template-columns: 42px minmax(0, 1fr) auto;
    }

    .elmax-related-hub--editorial .elmax-related-hub__item p {
        display: none;
    }
}

@media (max-width: 760px) {
    .elmax-ai-related {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 23px;
    }

    .elmax-ai-related__link {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }
}

@media (max-width: 600px) {
    .elmax-related-hub,
    .elmax-related-hub--editorial {
        margin: 42px 0;
        padding: 24px 20px;
        border-radius: 16px;
    }

    .elmax-related-hub--featured .elmax-related-hub__item,
    .elmax-related-hub--featured .elmax-related-hub__item--first,
    .elmax-related-hub--cards .elmax-related-hub__item,
    .elmax-related-hub--dark .elmax-related-hub__item {
        min-height: 0;
        padding: 20px;
    }

    .elmax-related-hub--editorial .elmax-related-hub__item {
        display: block;
        padding: 18px 8px 18px 42px;
    }

    .elmax-related-hub--editorial .elmax-related-hub__item::before {
        position: absolute;
        top: 20px;
        left: 8px;
    }

    .elmax-related-hub--editorial .elmax-related-hub__item h3 {
        margin-bottom: 9px !important;
    }

    .elmax-related-hub--editorial .elmax-related-hub__item strong {
        display: inline-block;
        white-space: normal;
    }
}
