/*
 * ck-content.css — style du contenu produit par CKEditor 5
 *
 * Cible UNIQUEMENT `.ck-content` (zone de rendu public + zone d'édition admin).
 * Le widget de l'éditeur (.ck-toolbar, .ck-editor__main, etc.) n'est PAS touché.
 *
 * Aligne le rendu sur le design system Codemaster :
 *   - Titres Fraunces medium · marine secondary-900
 *   - Italiques bordeaux signature
 *   - Corps Inter · ink-800
 *   - Listes éditoriales (carrés bordeaux pivotés, chiffres Fraunces)
 *   - Blockquote, code, table, images stylés "magazine premium"
 *
 * Tokens : primary-700 #5a1224 (bordeaux) · secondary-900 #13234f (marine) ·
 *          accent-600 #556954 (sauge) · cream-100 #f5efe0 · ink-950 #0c0f1a ·
 *          ink-800 #1b1e2a · muted-600 #6b6557 · saumon #e2a8a0
 */


/* ============================================================
 * CONTAINER — typo et couleurs de base
 * ============================================================ */

.ck-content {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: #1b1e2a;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ck-content > *:first-child {
    margin-top: 0 !important;
}

.ck-content > *:last-child {
    margin-bottom: 0 !important;
}


/* ============================================================
 * TITRES — Fraunces medium, marine secondary-900
 * ============================================================ */

.ck-content h1,
.ck-content h2,
.ck-content h3,
.ck-content h4,
.ck-content h5,
.ck-content h6 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    color: #13234f;
    letter-spacing: -0.018em;
    line-height: 1.15;
    margin: 1.8em 0 0.6em;
}

.ck-content h1 { font-size: clamp(2rem, 3.5vw, 2.75rem); }
.ck-content h2 { font-size: clamp(1.65rem, 2.8vw, 2.25rem); }
.ck-content h3 { font-size: clamp(1.3rem, 2vw, 1.65rem); }
.ck-content h4 { font-size: clamp(1.1rem, 1.6vw, 1.3rem); }
.ck-content h5 { font-size: 1.05rem; }
.ck-content h6 {
    font-size: 0.85rem;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6b6557;
}

/* H2 : marqueur "—" bordeaux à gauche */
.ck-content h2::before {
    content: "—";
    display: inline-block;
    margin-right: 14px;
    color: #5a1224;
    font-style: italic;
}

/* H3 : retrait italique bordeaux pour un mot mis en em */
.ck-content h2 em,
.ck-content h3 em,
.ck-content h4 em {
    font-style: italic;
    color: #5a1224;
    font-weight: 500;
}


/* ============================================================
 * CORPS — paragraphes
 * ============================================================ */

.ck-content p {
    margin: 0 0 1.2em;
    color: #1b1e2a;
}

.ck-content p:last-of-type {
    margin-bottom: 0;
}

/* Premier paragraphe d'un article → "chapô" éditorial discret */
.ck-content > p:first-of-type {
    font-size: 1.1em;
    line-height: 1.6;
    color: #0c0f1a;
}


/* ============================================================
 * EMPHASE — italique = bordeaux signature
 * ============================================================ */

.ck-content em,
.ck-content i {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    color: #5a1224;
    font-weight: 500;
}

.ck-content strong,
.ck-content b {
    color: #0c0f1a;
    font-weight: 500;
}

.ck-content u {
    text-decoration: none;
    background-image: linear-gradient(to right, #5a1224 0%, #5a1224 100%);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 100% 1px;
    padding-bottom: 2px;
}

.ck-content s,
.ck-content del {
    color: #6b6557;
    text-decoration-color: #5a1224;
}

.ck-content sub,
.ck-content sup {
    font-size: 0.65em;
    color: #5a1224;
}


/* ============================================================
 * LIENS — bordeaux avec underline animé éditorial
 * ============================================================ */

.ck-content a:not([class]),
.ck-content a:not(.btn-primary):not(.btn-outline):not(.btn-secondary):not(.btn-ghost):not([class*="bg-"]):not([class*="text-"]) {
    color: #5a1224;
    text-decoration: none;
    background-image: linear-gradient(to right, rgba(90, 18, 36, 0.35) 0%, rgba(90, 18, 36, 0.35) 100%);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 100% 1px;
    transition: background-size 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                background-image 0.25s ease;
    padding-bottom: 2px;
}

.ck-content a:not([class]):hover,
.ck-content a:not(.btn-primary):not(.btn-outline):not(.btn-secondary):not(.btn-ghost):not([class*="bg-"]):not([class*="text-"]):hover {
    background-image: linear-gradient(to right, #5a1224 0%, #5a1224 100%);
}

/* Liens avec décorateur "ouvrir nouvel onglet" : petit indicateur ↗ */
.ck-content a[target="_blank"]:not([class*="bg-"])::after {
    content: " ↗";
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.85em;
    color: #5a1224;
    opacity: 0.6;
    margin-left: 2px;
}


/* ============================================================
 * LISTES — puces signature éditoriales
 * ============================================================ */

.ck-content ul,
.ck-content ol {
    margin: 1.2em 0 1.4em;
    padding-left: 0;
    list-style: none;
}

.ck-content li {
    padding-left: 32px;
    position: relative;
    margin-bottom: 0.6em;
    line-height: 1.55;
}

.ck-content li > p {
    margin: 0;
    display: inline;
}

/* UL : losange bordeaux signature */
.ck-content ul > li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.62em;
    width: 8px;
    height: 8px;
    background: #5a1224;
    transform: rotate(45deg);
}

/* OL : chiffres Fraunces italique zéro-paddé */
.ck-content ol {
    counter-reset: ol-counter;
}

.ck-content ol > li {
    counter-increment: ol-counter;
    padding-left: 42px;
}

.ck-content ol > li::before {
    content: counter(ol-counter, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0.15em;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    color: #5a1224;
    font-size: 0.95em;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Listes imbriquées */
.ck-content li > ul,
.ck-content li > ol {
    margin: 0.5em 0 0.2em;
}

/* TODO LIST (CKEditor produit ul.todo-list) */
.ck-content ul.todo-list {
    list-style: none;
}

.ck-content ul.todo-list > li {
    padding-left: 32px;
}

.ck-content ul.todo-list > li::before {
    display: none;
}

.ck-content ul.todo-list > li input[type="checkbox"] {
    position: absolute;
    left: 0;
    top: 0.4em;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #5a1224;
    cursor: pointer;
}

.ck-content ul.todo-list > li.todo-list__label > .todo-list__label__description {
    color: #1b1e2a;
}

.ck-content ul.todo-list > li input[type="checkbox"]:checked + .todo-list__label__description {
    color: #6b6557;
    text-decoration: line-through;
}


/* ============================================================
 * BLOCKQUOTE — Fraunces italique, border-left bordeaux
 * ============================================================ */

.ck-content blockquote {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-size: clamp(1.2rem, 1.7vw, 1.5rem);
    line-height: 1.4;
    color: #13234f;
    border-left: 3px solid #5a1224;
    padding: 6px 0 6px 26px;
    margin: 1.8em 0;
    max-width: 50ch;
}

.ck-content blockquote em {
    font-style: normal;
    color: #5a1224;
}

.ck-content blockquote p {
    margin: 0 0 0.5em;
    color: inherit;
}

.ck-content blockquote p:last-child {
    margin-bottom: 0;
}


/* ============================================================
 * CODE — inline + bloc
 * ============================================================ */

.ck-content code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.88em;
    background: rgba(90, 18, 36, 0.07);
    color: #5a1224;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: -0.02em;
    border: 1px solid rgba(90, 18, 36, 0.12);
}

.ck-content pre {
    background: #0c0f1a;
    color: #f5efe0;
    padding: 22px 26px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13.5px;
    line-height: 1.6;
    margin: 1.6em 0;
    border: 1px solid rgba(12, 15, 26, 0.5);
    box-shadow: 0 8px 24px -8px rgba(12, 15, 26, 0.25);
}

.ck-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: 1em;
}


/* ============================================================
 * TABLES — éditorial premium
 * ============================================================ */

.ck-content figure.table {
    margin: 1.8em 0;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(12, 15, 26, 0.10);
}

.ck-content table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
}

.ck-content table th,
.ck-content table td {
    padding: 12px 16px;
    border: 1px solid rgba(12, 15, 26, 0.10);
    text-align: left;
    vertical-align: top;
}

.ck-content table thead th,
.ck-content table > tr:first-child th {
    background: #f5efe0;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #0c0f1a;
    font-weight: 500;
    border-bottom: 2px solid #5a1224;
}

.ck-content table tbody tr:nth-child(even) {
    background: rgba(245, 239, 224, 0.4);
}

.ck-content table tbody tr:hover {
    background: rgba(226, 168, 160, 0.10);
}


/* ============================================================
 * IMAGES — bordure éditoriale + shadow
 * ============================================================ */

.ck-content figure.image {
    margin: 2em 0;
    max-width: 100%;
}

.ck-content figure.image img,
.ck-content > img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
    border: 1px solid rgba(12, 15, 26, 0.08);
    box-shadow: 0 8px 24px -8px rgba(12, 15, 26, 0.18);
}

.ck-content figure.image figcaption {
    font-family: "Caveat", cursive;
    font-size: 19px;
    line-height: 1.4;
    color: #6b6557;
    text-align: center;
    margin-top: 14px;
    padding: 0 12px;
}

/* CKEditor 5 styles : align-left / align-right / align-center / side */
.ck-content .image-style-align-left {
    float: left;
    margin: 0.5em 1.6em 1em 0;
    max-width: 50%;
}

.ck-content .image-style-align-right {
    float: right;
    margin: 0.5em 0 1em 1.6em;
    max-width: 50%;
}

.ck-content .image-style-align-center,
.ck-content figure.image.image_resized {
    margin-left: auto;
    margin-right: auto;
}

.ck-content .image-style-side {
    float: right;
    margin: 0.5em 0 1em 1.6em;
    max-width: 50%;
}

/* Clear pour les floats */
.ck-content::after {
    content: "";
    display: block;
    clear: both;
}


/* ============================================================
 * MEDIA EMBED (YouTube, Vimeo, etc.)
 * ============================================================ */

.ck-content figure.media {
    margin: 1.8em 0;
    position: relative;
}

.ck-content figure.media .raw-html-embed,
.ck-content figure.media > div {
    aspect-ratio: 16 / 9;
    background: #ece5d6;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(12, 15, 26, 0.08);
}

.ck-content figure.media iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}


/* ============================================================
 * HR — séparateur éditorial avec glyphe central
 * ============================================================ */

.ck-content hr {
    border: none;
    border-top: 1px solid rgba(12, 15, 26, 0.15);
    margin: 2.6em auto;
    width: 50%;
    position: relative;
    overflow: visible;
}

.ck-content hr::after {
    content: "✦";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #ece5d6;
    color: #5a1224;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-size: 18px;
    padding: 0 12px;
    line-height: 1;
}


/* ============================================================
 * HIGHLIGHTS — mark (fontBackgroundColor de CKEditor)
 * ============================================================ */

.ck-content mark {
    background: rgba(226, 168, 160, 0.4);
    padding: 1px 4px;
    border-radius: 3px;
    color: #0c0f1a;
}


/* ============================================================
 * TEXT ALIGNMENT (classes générées par CKEditor)
 * ============================================================ */

.ck-content .text-tiny { font-size: 0.7em; }
.ck-content .text-small { font-size: 0.85em; }
.ck-content .text-big { font-size: 1.4em; line-height: 1.4; }
.ck-content .text-huge { font-size: 1.8em; line-height: 1.3; }

.ck-content [style*="text-align:center"],
.ck-content [style*="text-align: center"] { text-align: center !important; }
.ck-content [style*="text-align:right"],
.ck-content [style*="text-align: right"] { text-align: right !important; }
.ck-content [style*="text-align:justify"],
.ck-content [style*="text-align: justify"] { text-align: justify !important; }


/* ============================================================
 * RESPONSIVE — petits ajustements mobile
 * ============================================================ */

@media (max-width: 767px) {
    .ck-content {
        font-size: 16px;
    }
    .ck-content blockquote {
        margin-left: 0;
        padding-left: 18px;
        font-size: 1.1rem;
    }
    .ck-content .image-style-align-left,
    .ck-content .image-style-align-right,
    .ck-content .image-style-side {
        float: none;
        max-width: 100%;
        margin: 1.4em 0;
    }
    .ck-content pre {
        padding: 16px 18px;
        font-size: 12.5px;
    }
}
