/* Minecraft.fr — Carte mod inline (CurseForge & Modrinth), design "papier" */

/* ===== Wrapper paire ===== */
.mcfr-cf-cards-pair {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 24px 0;
}
@media (min-width: 1100px) {
    .mcfr-cf-cards-pair {
        grid-template-columns: 1fr 1fr;
    }
    .mcfr-cf-cards-pair .mcfr-cf-card {
        margin: 0;
    }
}

/* ===== Tokens globaux (au niveau :root pour survivre au RUCSS) ===== */
:root {
    --mcfr-bg: #fbfaf6;
    --mcfr-separator: #d8d4c2;
    --mcfr-text: #1a1a1a;
    --mcfr-text-muted: #6b6960;
    --mcfr-cta-outline: #1a1a1a;
}

/* ===== Tokens de thème par source (couleurs) ===== */
.mcfr-cf-card {
    --mcfr-color: #4caf50;
    --mcfr-color-dark: #3a8a3e;
    --mcfr-color-soft: #e8f5e1;
    --mcfr-color-border: #4caf50;
}
.mcfr-cf-card[data-source="curseforge"] {
    --mcfr-color: #f16436;
    --mcfr-color-dark: #c84e25;
    --mcfr-color-soft: #fde0d3;
    --mcfr-color-border: #f16436;
}
.mcfr-cf-card[data-source="modrinth"] {
    --mcfr-color: #1bd96a;
    --mcfr-color-dark: #16b157;
    --mcfr-color-soft: #d9f7e3;
    --mcfr-color-border: #1bd96a;
}

/* ===== Carte ===== */
.mcfr-cf-card {
    position: relative;
    box-sizing: border-box;
    background: var(--mcfr-bg);
    border: 3.5px solid var(--mcfr-color-border);
    border-radius: 12px;
    padding: 24px 20px 20px;
    margin: 32px auto 24px;
    max-width: 580px;
    min-height: 300px;
    color: var(--mcfr-text);
    font-family: inherit;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mcfr-cf-card *,
.mcfr-cf-card *::before,
.mcfr-cf-card *::after {
    box-sizing: border-box;
}

/* ===== Badge source (haut gauche, à cheval sur le liseré) ===== */
.mcfr-cf-card__source-badge {
    position: absolute;
    top: -14px;
    left: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--mcfr-bg);
    border: 2px solid var(--mcfr-color);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mcfr-color-dark);
    line-height: 1.3;
}
.mcfr-cf-card__source-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mcfr-color);
    flex-shrink: 0;
}
.mcfr-cf-card__source-name {
    font-family: inherit;
}

/* ===== Header ===== */
.mcfr-cf-card__header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.mcfr-cf-card__logo {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    background: #efece2;
    border: 1.5px solid #d8d4c2;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mcfr-cf-card__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mcfr-cf-card__logo-placeholder {
    font-size: 11px;
    color: #999;
    text-transform: lowercase;
}

.mcfr-cf-card__title-block {
    flex: 1 1 auto;
    min-width: 0;
}

.mcfr-cf-card__title {
    margin: 0 0 2px;
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    color: var(--mcfr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mcfr-cf-card__title-link {
    color: inherit;
    cursor: pointer;
}
.mcfr-cf-card__title-link:hover { text-decoration: underline; }

.mcfr-cf-card__subline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--mcfr-text-muted);
}

.mcfr-cf-card__type-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    background: #e3f5d3;
    color: #3a7a14;
}
.mcfr-cf-card__type-badge--texture_pack { background: #fff2cc; color: #8a6d00; }
.mcfr-cf-card__type-badge--shader       { background: #dde7ff; color: #2b4ea8; }
.mcfr-cf-card__type-badge--map          { background: #f6dce6; color: #9c2256; }
.mcfr-cf-card__type-badge--modpack      { background: #e8e0fb; color: #5a3aa1; }
.mcfr-cf-card__type-badge--datapack     { background: #ffe0e0; color: #a13030; }
.mcfr-cf-card__type-badge--plugin       { background: #d4f1f4; color: #1f6e7c; }

.mcfr-cf-card__author-link {
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(0, 0, 0, 0.3);
}

.mcfr-cf-card__summary {
    margin: 4px 0 0;
    color: #444;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mcfr-cf-card__stale {
    margin: 4px 0 0;
    color: #b04400;
    font-size: 12px;
    font-weight: 600;
}

/* ===== Stats (4 KPI avec séparateurs verticaux hand-drawn) ===== */
.mcfr-cf-card__stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.mcfr-cf-card__stat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 8px;
    min-width: 0;
}

/* Séparateur vertical hand-drawn entre stats (SVG inline) */
.mcfr-cf-card__stat + .mcfr-cf-card__stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='3' height='40' viewBox='0 0 3 40' preserveAspectRatio='none'%3E%3Cpath d='M1.5 2 Q2.4 10 1.1 20 Q2.4 30 1.5 38' stroke='%23d8d4c2' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 3px 100%;
}

.mcfr-cf-card__stat-value {
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    color: var(--mcfr-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    line-height: 1.1;
}

.mcfr-cf-card__stat-label {
    font-size: 11px;
    color: var(--mcfr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mcfr-cf-card__stat-label-short { display: inline; }
.mcfr-cf-card__stat-label-full { display: none; }

/* ===== Squiggle horizontal séparateur ===== */
.mcfr-cf-card__squiggle {
    height: 6px;
    margin: 0 -4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='6' viewBox='0 0 200 6' preserveAspectRatio='none'%3E%3Cpath d='M0 3 Q10 0 20 3 T40 3 T60 3 T80 3 T100 3 T120 3 T140 3 T160 3 T180 3 T200 3' stroke='%23d8d4c2' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
    background-size: 200px 6px;
    background-repeat: repeat-x;
    background-position: center;
}

/* ===== Compatibilité (MC + LOADER côte à côte) ===== */
.mcfr-cf-card__compat {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.mcfr-cf-card__compat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.mcfr-cf-card__compat-row + .mcfr-cf-card__compat-row {
    border-left: 1.5px solid var(--mcfr-separator);
    padding-left: 12px;
}

.mcfr-cf-card__compat-group-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mcfr-text-muted);
    font-weight: 700;
    margin-right: 2px;
}

.mcfr-cf-card__badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1.2px solid #d4d4d4;
    background: #fff;
    color: #333;
    white-space: nowrap;
}

.mcfr-cf-card__badge--mc       { border-color: #c8c8c0; color: #1f2937; }
.mcfr-cf-card__badge--mc-extra { background: #efece2; border-color: #c8c8c0; color: #555; }
.cf-obf-link.mcfr-cf-card__badge--mc { cursor: pointer; }
.cf-obf-link.mcfr-cf-card__badge--mc:hover { background: #efece2; }
.cf-obf-link.mcfr-cf-card__badge--mc-extra:hover { background: #e5e1d2; color: #333; }

.mcfr-cf-card__badge--loader-forge     { border-color: #4d9b3d; color: #2a6a1f; background: #e7f5e0; }
.mcfr-cf-card__badge--loader-fabric    { border-color: #8b6b3f; color: #5a3f15; background: #f7ecda; }
.mcfr-cf-card__badge--loader-neoforge  { border-color: #f16436; color: #b13d11; background: #fde0d3; }
.mcfr-cf-card__badge--loader-quilt     { border-color: #9b6db8; color: #4d2466; background: #f1e2fa; }

/* ===== CTA ===== */
.mcfr-cf-card__cta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
}

.mcfr-cf-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 auto;
    height: 44px;
    padding: 0 18px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 8px;
    letter-spacing: 0.02em;
    transition: filter 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    border: 2px solid var(--mcfr-cta-outline);
    line-height: 1;
}

.mcfr-cf-card__btn--primary {
    background: var(--mcfr-color);
    color: #fff;
}

.mcfr-cf-card__btn--primary:hover,
.mcfr-cf-card__btn--primary:focus {
    background: var(--mcfr-color);
    color: #fff;
    filter: brightness(0.95);
    text-decoration: none;
}

.mcfr-cf-card__btn-label {
    white-space: nowrap;
}

.mcfr-cf-card__btn-icon {
    font-size: 1em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.mcfr-cf-card__btn-icon img {
    width: 28px;
    height: 28px;
    display: block;
    image-rendering: pixelated;
}

.mcfr-cf-card__btn-arrow {
    display: inline-block;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.15s ease;
}

.mcfr-cf-card__btn:hover .mcfr-cf-card__btn-arrow,
.mcfr-cf-card__btn:focus .mcfr-cf-card__btn-arrow {
    transform: translateX(2px);
}

.mcfr-cf-card__cta-secondary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.mcfr-cf-card__link {
    color: var(--mcfr-color-dark);
    text-decoration: underline;
    font-size: 13px;
    cursor: pointer;
}

.cf-obf-link { cursor: pointer; }
.cf-obf-link:focus-visible {
    outline: 2px solid var(--mcfr-color-dark);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== Variant fusionnée (CurseForge + Modrinth) ===== */
.mcfr-cf-card--merged {
    /* Liseré bicolore : orange à gauche, vert à droite. */
    border: 3.5px solid transparent;
    background:
        linear-gradient(var(--mcfr-bg), var(--mcfr-bg)) padding-box,
        linear-gradient(to right, #f16436 0%, #f16436 50%, #1bd96a 50%, #1bd96a 100%) border-box;
}

.mcfr-cf-card__source-badges {
    position: absolute;
    top: -14px;
    left: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}
.mcfr-cf-card__source-badges .mcfr-cf-card__source-badge {
    position: static;
    top: auto;
    left: auto;
}
.mcfr-cf-card__source-badge--cf {
    border-color: #f16436;
    color: #c84e25;
}
.mcfr-cf-card__source-badge--cf .mcfr-cf-card__source-dot { background: #f16436; }
.mcfr-cf-card__source-badge--mr {
    border-color: #1bd96a;
    color: #16b157;
}
.mcfr-cf-card__source-badge--mr .mcfr-cf-card__source-dot { background: #1bd96a; }
.mcfr-cf-card__source-plus {
    font-family: inherit;
    font-size: 18px;
    color: #555;
    line-height: 1;
}

/* CTA double : 2 boutons cote à cote */
.mcfr-cf-card__cta--dual {
    display: flex;
    gap: 12px;
    margin-top: auto;
}
.mcfr-cf-card__cta--dual .mcfr-cf-card__btn {
    flex: 1 1 50%;
}
.mcfr-cf-card__btn--cf {
    background: #f16436;
    color: #fff;
    border: 2px solid var(--mcfr-cta-outline);
}
.mcfr-cf-card__btn--cf:hover,
.mcfr-cf-card__btn--cf:focus {
    background: #f16436;
    filter: brightness(0.95);
    color: #fff;
    text-decoration: none;
}
.mcfr-cf-card__btn--mr {
    background: #1bd96a;
    color: #fff;
    border: 2px solid var(--mcfr-cta-outline);
}
.mcfr-cf-card__btn--mr:hover,
.mcfr-cf-card__btn--mr:focus {
    background: #1bd96a;
    filter: brightness(0.95);
    color: #fff;
    text-decoration: none;
}

.mcfr-cf-card__cta-tagline {
    margin: 4px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--mcfr-text-muted);
    font-style: italic;
}

@media (max-width: 599px) {
    .mcfr-cf-card__source-badges {
        gap: 4px;
        font-size: 11px;
    }
    .mcfr-cf-card__cta--dual {
        flex-direction: column;
    }
}

/* ===== Mode compact dans le pair (desktop, espace réduit) ===== */
@media (min-width: 1100px) {
    .mcfr-cf-cards-pair .mcfr-cf-card__title { font-size: 19px; }
    .mcfr-cf-cards-pair .mcfr-cf-card__stat-value { font-size: 19px; }
    .mcfr-cf-cards-pair .mcfr-cf-card__btn { font-size: 15px; }
}

/* ===== Mobile (< 600 px) — version 360 px ===== */
@media (max-width: 599px) {
    .mcfr-cf-card {
        padding: 20px 16px 16px;
        margin: 28px 0 20px;
        min-height: 0;
    }

    .mcfr-cf-card__header {
        gap: 12px;
    }

    .mcfr-cf-card__logo {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
    }

    .mcfr-cf-card__title {
        font-size: 20px;
        white-space: normal;
        line-height: 1.15;
    }

    .mcfr-cf-card__subline {
        gap: 6px;
    }

    /* Stats : 3 colonnes (DL · MAJ · TAILLE) — icônes et fontes réduites
       pour que « 12,5 M », « 1 mois », « 6,4 Mo » ne soient pas coupés. */
    .mcfr-cf-card__stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .mcfr-cf-card__stat-value {
        font-size: 17px;
        gap: 5px;
    }
    .mcfr-cf-card__stat-icon {
        width: 22px;
        height: 22px;
    }

    /* Masquer la 4e+ version MC sur mobile (gardées dans le DOM pour le SEO) */
    .mcfr-cf-card__badge--hide-mobile {
        display: none;
    }

    /* Badges en scroll horizontal */
    .mcfr-cf-card__compat {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .mcfr-cf-card__compat-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .mcfr-cf-card__compat-row::-webkit-scrollbar {
        height: 4px;
    }
    .mcfr-cf-card__compat-row::-webkit-scrollbar-thumb {
        background: var(--mcfr-separator);
        border-radius: 2px;
    }
    .mcfr-cf-card__compat-row + .mcfr-cf-card__compat-row {
        border-left: none;
        padding-left: 0;
    }

    .mcfr-cf-card__cta {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .mcfr-cf-card__btn {
        width: 100%;
    }
    .mcfr-cf-card__cta-secondary {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===== Lien guide installation par type ===== */
.mcfr-cf-card__guide {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--mcfr-text-muted);
    line-height: 1.45;
    text-align: center;
}
.mcfr-cf-card__guide a {
    color: var(--mcfr-color-dark);
    text-decoration: underline;
}
.mcfr-cf-card__guide a:hover {
    text-decoration: none;
}

/* ===== Loaders linkés (Forge / NeoForge / Fabric) ===== */
a.mcfr-cf-card__badge--loader {
    text-decoration: none;
    cursor: pointer;
}
a.mcfr-cf-card__badge--loader:hover {
    filter: brightness(0.95);
}

/* ===== Override des liens hérités du thème (minecraft.fr force `a { color: green }`) ===== */
/* Boutons CTA : texte blanc forcé sur fond coloré, peu importe la couleur de lien du thème */
.mcfr-cf-card a.mcfr-cf-card__btn,
.mcfr-cf-card a.mcfr-cf-card__btn:hover,
.mcfr-cf-card a.mcfr-cf-card__btn:focus,
.mcfr-cf-card a.mcfr-cf-card__btn:visited,
.mcfr-cf-card a.mcfr-cf-card__btn:active {
    color: #fff;
    text-decoration: none;
}

/* Lien secondaire « ↗ Modrinth » : couleur source dark */
.mcfr-cf-card a.mcfr-cf-card__link,
.mcfr-cf-card a.mcfr-cf-card__link:visited {
    color: var(--mcfr-color-dark);
}

/* Lien guide en bas de carte : même couleur source dark */
.mcfr-cf-card .mcfr-cf-card__guide a,
.mcfr-cf-card .mcfr-cf-card__guide a:visited {
    color: var(--mcfr-color-dark);
}

/* Loaders linkés : on garde la couleur du badge (texte coloré sur fond clair) */
.mcfr-cf-card a.mcfr-cf-card__badge--loader,
.mcfr-cf-card a.mcfr-cf-card__badge--loader:visited {
    color: inherit;
}

/* ===== Icônes SVG (stats + CTA) — pixel-art rendering ===== */
.mcfr-cf-card__stat-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    image-rendering: pixelated;
}
