/* ck_content.css — LucaBTP
 * Habillage éditorial du contenu CKEditor 5, aligné sur le rendu de la home
 * (Inter + Bricolage Grotesque, palette slate/amber, shadows editorial).
 *
 * Cible deux contextes :
 *   - Front public : <div class="ck-content"> injecté par {% render_richtext %}.
 *   - Édition : .ck.ck-content.ck-editor__editable (WYSIWYG identique au rendu).
 */

:where(.ck-content) {
    --luca-amber-400: #fbbf24;
    --luca-amber-500: #f59e0b;
    --luca-amber-600: #d97706;
    --luca-amber-700: #b45309;
    --luca-slate-200: #e2e8f0;
    --luca-slate-300: #cbd5e1;
    --luca-slate-400: #94a3b8;
    --luca-slate-500: #64748b;
    --luca-slate-600: #475569;
    --luca-slate-700: #334155;
    --luca-slate-800: #1e293b;
    --luca-slate-900: #0f172a;
    --luca-stone-50:  #fafaf9;
    --luca-stone-100: #f5f5f4;
    --luca-radius:    1rem;
    --luca-shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.08);
    --luca-shadow-md: 0 8px 24px -8px rgba(15, 23, 42, 0.12);
    --luca-shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.15);

    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--luca-slate-700);
    word-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Éditeur (WYSIWYG identique au rendu front) ─────────────── */
.ck.ck-content.ck-editor__editable {
    min-height: 460px;
    background: #fff;
    padding: 1.5rem 1.75rem;
    color: var(--luca-slate-700);
}

/* ─── Titres ─────────────────────────────────────────────────── */
.ck-content h1,
.ck-content h2,
.ck-content h3,
.ck-content h4,
.ck-content h5,
.ck-content h6 {
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    color: var(--luca-slate-800);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-top: 2.25em;
    margin-bottom: 0.7em;
}

.ck-content > h1:first-child,
.ck-content > h2:first-child,
.ck-content > h3:first-child,
.ck-content > h4:first-child {
    margin-top: 0;
}

.ck-content h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.025em;
}

.ck-content h2 {
    font-size: clamp(1.65rem, 3vw, 2.125rem);
    font-weight: 700;
    position: relative;
    padding-bottom: 0.55em;
    margin-top: 2.5em;
}
.ck-content h2::after {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 3px;
    background: var(--luca-amber-500);
    border-radius: 9999px;
}

.ck-content h3 {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    font-weight: 700;
}

.ck-content h4 {
    font-size: 1.2rem;
    font-weight: 700;
}

.ck-content h5 {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--luca-amber-600);
}

.ck-content h6 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--luca-slate-500);
}

/* ─── Paragraphes / typographie inline ───────────────────────── */
.ck-content p {
    margin: 0 0 1.1em;
}

.ck-content strong,
.ck-content b {
    font-weight: 600;
    color: var(--luca-slate-800);
}

.ck-content em,
.ck-content i {
    font-style: italic;
}

.ck-content small {
    font-size: 0.85em;
    color: var(--luca-slate-500);
}

.ck-content mark {
    background: rgba(245, 158, 11, 0.18);
    color: var(--luca-slate-800);
    padding: 0 0.15em;
    border-radius: 2px;
}

/* ─── Liens — accent amber + underline animé ─────────────────── */
.ck-content a {
    color: var(--luca-amber-600);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 100% 1px;
    background-position: 0 calc(100% - 1px);
    background-repeat: no-repeat;
    padding-bottom: 1px;
    transition: color 0.25s ease, background-size 0.4s ease;
    font-weight: 500;
}
.ck-content a:hover {
    color: var(--luca-amber-700);
    background-size: 100% 2px;
}

/* ─── Listes ────────────────────────────────────────────────── */
.ck-content ul,
.ck-content ol {
    margin: 0 0 1.25em;
    padding-left: 1.5em;
}
.ck-content li {
    margin-bottom: 0.45em;
    padding-left: 0.25em;
}
.ck-content li::marker {
    color: var(--luca-amber-500);
    font-weight: 700;
}
.ck-content ul ul,
.ck-content ol ol,
.ck-content ul ol,
.ck-content ol ul {
    margin: 0.5em 0;
}

/* Listes à cases (todoList CKEditor) */
.ck-content ul.todo-list {
    list-style: none;
    padding-left: 0;
}
.ck-content ul.todo-list li {
    position: relative;
    padding-left: 1.85em;
}
.ck-content ul.todo-list li input[type="checkbox"] {
    position: absolute;
    left: 0;
    top: 0.35em;
    accent-color: var(--luca-amber-500);
}

/* ─── Blockquote — style "introduction" de l'article ─────────── */
.ck-content blockquote {
    margin: 1.75em 0;
    padding: 0.25em 0 0.25em 1.5em;
    border-left: 4px solid var(--luca-amber-500);
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.18em;
    color: var(--luca-slate-600);
    line-height: 1.55;
}
.ck-content blockquote p {
    margin-bottom: 0.5em;
}
.ck-content blockquote p:last-child {
    margin-bottom: 0;
}

/* ─── Séparateur ─────────────────────────────────────────────── */
.ck-content hr {
    border: none;
    height: 3px;
    width: 56px;
    background: var(--luca-amber-500);
    border-radius: 9999px;
    margin: 2.75em auto;
}

/* ─── Images & figures ───────────────────────────────────────── */
.ck-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--luca-radius);
    box-shadow: var(--luca-shadow-lg);
}

.ck-content figure {
    margin: 1.75em 0;
}
.ck-content figure.image img,
.ck-content figure.image-style-block-align-center img {
    display: block;
    margin: 0 auto;
}
.ck-content figure figcaption {
    margin-top: 0.7em;
    font-size: 0.85em;
    color: var(--luca-slate-500);
    font-style: italic;
    text-align: center;
}

.ck-content figure.image-style-align-left,
.ck-content .image-style-align-left {
    float: left;
    margin: 0.4em 1.5em 0.75em 0;
    max-width: 50%;
}
.ck-content figure.image-style-align-right,
.ck-content .image-style-align-right {
    float: right;
    margin: 0.4em 0 0.75em 1.5em;
    max-width: 50%;
}
.ck-content figure.image-style-side {
    float: right;
    margin: 0.4em 0 0.75em 1.5em;
    max-width: 40%;
}

/* ─── Tableaux ───────────────────────────────────────────────── */
.ck-content figure.table {
    margin: 1.75em 0;
    overflow-x: auto;
}
.ck-content table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.95em;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--luca-shadow-sm);
}
.ck-content table th {
    background: var(--luca-slate-800);
    color: #fff;
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    font-weight: 600;
    text-align: left;
    padding: 0.85em 1em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.82em;
    border: none;
}
.ck-content table td {
    padding: 0.75em 1em;
    border-top: 1px solid var(--luca-slate-200);
    background: #fff;
    vertical-align: top;
}
.ck-content table tr:nth-child(even) td {
    background: var(--luca-stone-50);
}

/* ─── Code ───────────────────────────────────────────────────── */
.ck-content code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
    padding: 0.15em 0.4em;
    border-radius: 0.35rem;
    background: var(--luca-stone-100);
    color: var(--luca-amber-600);
    font-weight: 500;
}

.ck-content pre {
    margin: 1.5em 0;
    padding: 1.15em 1.35em;
    border-radius: 0.85rem;
    background: var(--luca-slate-900);
    color: #f1f5f9;
    overflow-x: auto;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
    line-height: 1.65;
    box-shadow: var(--luca-shadow-md);
}
.ck-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-weight: 400;
}

/* ─── Surlignages CKEditor ───────────────────────────────────── */
.ck-content .marker-yellow { background: #fef08a; padding: 0 0.1em; }
.ck-content .marker-green  { background: #bbf7d0; padding: 0 0.1em; }
.ck-content .marker-pink   { background: #fbcfe8; padding: 0 0.1em; }
.ck-content .marker-blue   { background: #bfdbfe; padding: 0 0.1em; }
.ck-content .pen-red       { color: #dc2626; }
.ck-content .pen-green     { color: #16a34a; }

/* ─── Clearfix pour images flottantes ────────────────────────── */
.ck-content::after {
    content: "";
    display: block;
    clear: both;
}

/* ─── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ck-content { font-size: 1rem; }
    .ck-content h1 { font-size: 1.75rem; }
    .ck-content h2 { font-size: 1.5rem; }
    .ck-content h3 { font-size: 1.2rem; }
    .ck-content figure.image-style-align-left,
    .ck-content figure.image-style-align-right,
    .ck-content figure.image-style-side {
        float: none;
        margin: 1.25em auto;
        max-width: 100%;
    }
    .ck.ck-content.ck-editor__editable {
        padding: 1rem 1.1rem;
        min-height: 360px;
    }
}
