/* ==========================================================================
   Solutions Codexalia — feuille de style du site (chargée après Bootstrap).
   Système visuel repris de la carte professionnelle : papier chaud, encre,
   or comme seul accent ; Montserrat gras, italique à empattements, chasse fixe.
   ========================================================================== */

/* ---------- Polices hébergées localement (jamais de réseau de diffusion externe) ---------- */
@font-face {
    font-family: 'Montserrat';
    src: url('../vendor/fonts/montserrat-var.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: 'Libre Baskerville';
    src: url('../vendor/fonts/libre-baskerville-italic.woff2') format('woff2');
    font-style: italic;
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../vendor/fonts/jetbrains-mono-var.woff2') format('woff2');
    font-weight: 100 800;
    font-display: swap;
}

/* ---------- Jetons ---------- */
:root {
    --ink: #16161a;
    --ink-soft: #23232a;
    --ink-line: rgba(247, 243, 232, 0.14);
    --paper: #f7f3e8;
    --paper-deep: #efe9d8;
    --gold: #c9a227;
    /* L'or pur manque de contraste sur le papier : version foncée pour le texte */
    --gold-text: #876a10;
    --gold-soft: #e2c56a;
    --muted: #62616b;
    --line: rgba(22, 22, 26, 0.14);

    --font-display: 'Montserrat', 'Segoe UI', sans-serif;
    --font-serif: 'Libre Baskerville', Georgia, serif;
    --font-mono: 'JetBrains Mono', Consolas, monospace;

    --section-space: clamp(4.5rem, 10vw, 8.5rem);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-display);
    font-weight: 450;
    color: var(--ink);
    background-color: var(--paper);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* Grain du papier : bruit vectoriel fixe, très léger, par-dessus toute la page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 {
    font-weight: 850;
    letter-spacing: -0.035em;
    line-height: 1.02;
    text-wrap: balance;
}
h1 { font-size: clamp(2.7rem, 7.4vw, 6rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.5rem); }
h3 { font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.15; }

/* Le mot en italique à empattements et en or : la signature de la marque */
h1 em, h2 em, .footer-tagline em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--gold-text);
}

p { text-wrap: pretty; }
a { color: inherit; }
::selection { background: var(--gold); color: var(--ink); }

:focus-visible {
    outline: 2px solid var(--gold-text);
    outline-offset: 3px;
    border-radius: 2px;
}

.lead-text {
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
    color: var(--muted);
    max-width: 38em;
}

.mono-tag {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--gold-text);
    margin-bottom: 1.25rem;
}

.eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.section { padding-block: var(--section-space); }
.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }

/* Section sombre : le verso de la carte */
.section-ink {
    background:
        radial-gradient(60rem 30rem at 0% 100%, rgba(201, 162, 39, 0.16), transparent 60%),
        var(--ink);
    color: var(--paper);
}
.section-ink .lead-text, .section-ink .eyebrow { color: rgba(247, 243, 232, 0.62); }
.section-ink .mono-tag, .section-ink h2 em { color: var(--gold-soft); }

/* ---------- Boutons et liens ---------- */
.btn-ink, .btn-gold, .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.7rem;
    border: 2px solid transparent;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.35s var(--ease), background-color 0.25s, color 0.25s, border-color 0.25s;
}
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--gold); color: var(--ink); transform: translateY(-2px); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--paper); color: var(--ink); transform: translateY(-2px); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger-ink { background: #8f2a1f; color: var(--paper); }
.btn-danger-ink:hover { background: #6f1f16; color: var(--paper); }
.btn-sm { padding: 0.6rem 1.15rem; font-size: 0.7rem; }

.arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 0.25rem;
}
.arrow-link::after { content: '→'; transition: transform 0.35s var(--ease); }
.arrow-link:hover::after { transform: translateX(6px); }

/* ---------- En-tête ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(247, 243, 232, 0.86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.site-header .navbar { padding-block: 0.9rem; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
}
.wordmark { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.05em; line-height: 1; }
.wordmark-x { color: var(--gold); }
.brand:hover .logo-mark polyline:first-of-type { transform: translateX(-5px); }
.brand:hover .logo-mark polyline:last-of-type { transform: translateX(5px); }
.logo-mark polyline { transition: transform 0.4s var(--ease); }

.site-nav { align-items: center; gap: 0.35rem; }
.site-nav .nav-link {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 0.5rem 0.85rem;
}
.site-nav .nav-link:hover, .site-nav .nav-link.active { color: var(--gold-text); }
.lang-switch { font-family: var(--font-mono); letter-spacing: 0.04em !important; }
.navbar-toggler { border: 0; }
.navbar-toggler:focus { box-shadow: none; }

.flash-zone { padding-top: 1.5rem; }
.alert { border-radius: 0.4rem; border: 1px solid var(--line); font-weight: 600; }
.alert-success { background: #e9eed9; color: #2f4a16; }
.alert-danger { background: #f4dfd9; color: #6f1f16; }

/* ---------- Accueil : héros ---------- */
.hero { padding-block: clamp(3.5rem, 8vw, 7rem) var(--section-space); }
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: end;
}
.hero h1 { margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.75rem; margin-top: 2.5rem; }

/* Panneau de code : l'idée du client « compilée » en logiciel */
.code-panel {
    background: var(--ink);
    color: rgba(247, 243, 232, 0.78);
    border-radius: 0.9rem;
    padding: 1.4rem 1.5rem 1.7rem;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    line-height: 1.95;
    box-shadow: 0 2.5rem 5rem -2rem rgba(22, 22, 26, 0.55);
    transform: rotate(1.6deg);
    transition: transform 0.6s var(--ease);
}
.code-panel:hover { transform: rotate(0deg); }
.code-panel-bar { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; }
.code-panel-bar span { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: rgba(247, 243, 232, 0.2); }
.code-panel-bar span:first-child { background: var(--gold); }
.code-line { display: block; white-space: pre-wrap; counter-increment: line; }
.code-line::before {
    content: counter(line, decimal-leading-zero);
    display: inline-block;
    width: 2.2em;
    color: rgba(247, 243, 232, 0.25);
}
.code-panel code { counter-reset: line; color: inherit; font-size: inherit; }
.code-tag { color: var(--gold-soft); font-weight: 700; }
.code-dim { color: rgba(247, 243, 232, 0.4); }
.caret {
    display: inline-block;
    width: 0.55em;
    height: 1.1em;
    margin-left: 0.2em;
    vertical-align: text-bottom;
    background: var(--gold);
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Liste numérotée (services, approche, étapes) ---------- */
.numbered-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.numbered-list > li {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 1.5rem;
    align-items: baseline;
    padding-block: 1.9rem;
    border-bottom: 1px solid var(--line);
    transition: padding-left 0.45s var(--ease);
}
.numbered-list > li:hover { padding-left: 0.9rem; }
/* Variante à deux colonnes : numéro + bloc titre/texte (colonne étroite) */
.numbered-list.is-compact > li { grid-template-columns: 3rem minmax(0, 1fr); }
.numbered-list .number { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; color: var(--gold-text); }
.numbered-list h3 { margin: 0; }
.numbered-list p { margin: 0; color: var(--muted); }
.section-ink .numbered-list { border-top-color: var(--paper); }
.section-ink .numbered-list > li { border-bottom-color: var(--ink-line); }
.section-ink .numbered-list .number { color: var(--gold-soft); }
.section-ink .numbered-list p { color: rgba(247, 243, 232, 0.62); }

/* ---------- Produits ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); gap: 1.25rem; }
.product-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.6rem;
    border: 1px solid var(--ink-line);
    border-radius: 0.9rem;
    background: rgba(247, 243, 232, 0.035);
    transition: transform 0.45s var(--ease), border-color 0.3s, background-color 0.3s;
}
.product-card:hover { transform: translateY(-5px); border-color: var(--gold); background: rgba(247, 243, 232, 0.06); }
.product-card.is-soon { border-style: dashed; }
.product-card-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
/* Coins arrondis : adoucit un logo téléversé sur fond blanc carré */
.product-card-image { max-height: 3.5rem; max-width: 60%; object-fit: contain; border-radius: 0.6rem; }
.product-card-name { margin: 0; font-size: 1.6rem; }
.product-card-tagline { margin: 0; font-weight: 600; }
.product-card-description { margin: 0; font-size: 0.95rem; opacity: 0.68; }
.product-card .arrow-link { margin-top: auto; }

.chip, .status {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.chip { padding: 0.35rem 0.75rem; border: 1px solid currentColor; border-radius: 999px; opacity: 0.7; }
.status { font-family: var(--font-mono); letter-spacing: 0.06em; opacity: 0.55; }
.status-live { color: var(--gold-soft); opacity: 1; }
.status-live::before {
    content: '';
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.6);
    animation: pulse 2.4s infinite;
}
@keyframes pulse { 70%, 100% { box-shadow: 0 0 0 0.55rem rgba(201, 162, 39, 0); } }

/* ---------- Bandeau d'appel à l'action ---------- */
.cta-band { background: var(--ink); color: var(--paper); padding-block: clamp(3.5rem, 7vw, 6rem); border-top: 1px solid var(--ink-line); }
.cta-band-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 2rem; }
.cta-band h2 { margin: 0; }
.cta-band h2 em, .cta-band .mono-tag { color: var(--gold-soft); }

/* ---------- Pages intérieures ---------- */
.page-head { padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(2.5rem, 5vw, 4rem); }
.page-head h1 { font-size: clamp(2.4rem, 6vw, 4.8rem); margin-bottom: 1.75rem; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: clamp(2rem, 6vw, 6rem); }

/* Encadré « projets choisis » */
.note-box { border-left: 4px solid var(--gold); background: var(--paper-deep); padding: 1.75rem 2rem; border-radius: 0 0.6rem 0.6rem 0; }
.note-box h3 { margin-bottom: 0.6rem; }
.note-box p { margin: 0; color: var(--muted); }

.prose { max-width: 44rem; }
.prose h2 { font-size: 1.6rem; margin: 2.75rem 0 0.9rem; letter-spacing: -0.02em; }
.prose p, .prose li { color: #3a3942; }
.prose a { color: var(--gold-text); font-weight: 700; }

/* À propos : portrait et fiche */
.portrait {
    aspect-ratio: 4 / 5;
    width: 100%;
    border-radius: 0.9rem;
    /* La photo remplit tout le cadre ; le rognage privilégie le haut (la tête) */
    object-fit: cover;
    object-position: center 20%;
    background: var(--ink);
    color: var(--paper);
    display: grid;
    place-items: center;
}
/* En attendant la photo : le logo, sur le fond sombre du verso de la carte */
.portrait-placeholder {
    background:
        radial-gradient(28rem 20rem at 0% 100%, rgba(201, 162, 39, 0.2), transparent 65%),
        var(--ink);
}
.portrait-placeholder .logo-mark { width: 55%; height: auto; }
.fact-sheet { margin: 1.5rem 0 0; font-size: 0.9rem; }
.fact-sheet div { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.7rem; border-bottom: 1px solid var(--line); }
.fact-sheet dt { font-weight: 800; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.fact-sheet dd { margin: 0; font-weight: 650; text-align: right; }

/* ---------- Formulaires ---------- */
.form-field { margin-bottom: 1.4rem; }
.form-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.form-control, .form-select {
    background-color: #fffdf6;
    border: 1.5px solid var(--line);
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    font-weight: 500;
    color: var(--ink);
}
.form-control:focus, .form-select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.35); background-color: #fff; }
/* Exemple en gris dans un champ vide : assez pâle pour ne pas passer pour une valeur saisie */
.form-control::placeholder { color: #a9a596; font-weight: 450; opacity: 1; }
.form-help { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.form-error { font-size: 0.82rem; font-weight: 700; color: #8f2a1f; margin-top: 0.35rem; }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
/* Piège à robots : hors écran plutôt que display:none, que certains robots détectent */
.hp-field { position: absolute; left: -200vw; width: 1px; height: 1px; overflow: hidden; }

.form-card { background: var(--paper-deep); border-radius: 0.9rem; padding: clamp(1.5rem, 4vw, 2.75rem); }
/* Cible d'ancre (#formulaire) : ne pas la cacher sous l'en-tête collant */
.form-card[id] { scroll-margin-top: 6.5rem; }
/* Champ en erreur : bordure rouge, pour qu'on le repère d'un coup d'œil */
.form-field:has(.form-error) .form-control, .form-field:has(.form-error) .form-select { border-color: #8f2a1f; }

/* ---------- Back-office ---------- */
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1.5rem; padding-block: 3rem 2rem; }
.admin-head h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0; }
.admin-tabs { display: flex; gap: 0.5rem; margin-bottom: 2rem; border-bottom: 2px solid var(--ink); }
.admin-tabs a {
    padding: 0.7rem 1.2rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 0.5rem 0.5rem 0 0;
}
.admin-tabs a.active { background: var(--ink); color: var(--paper); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0.75rem; border-bottom: 2px solid var(--ink); }
.admin-table td { padding: 0.95rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:hover td { background: var(--paper-deep); }
.admin-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
.badge-status { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 0.3rem; background: var(--paper-deep); }
.badge-status.is-launched { background: var(--ink); color: var(--gold-soft); }
.badge-status.is-hidden { opacity: 0.5; text-decoration: line-through; }
.message-card { border: 1px solid var(--line); border-radius: 0.7rem; padding: 1.4rem 1.6rem; margin-bottom: 1rem; background: #fffdf6; }
.message-card.is-handled { opacity: 0.55; background: transparent; }
.message-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.8rem; }
.message-body { white-space: pre-wrap; margin-bottom: 1rem; }
.empty-state { padding: 4rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 0.9rem; }

.modal-content { background: var(--paper); border: 0; border-radius: 0.9rem; }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-weight: 850; letter-spacing: -0.02em; }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--ink); color: rgba(247, 243, 232, 0.7); padding-block: 4.5rem 2rem; border-top: 1px solid var(--ink-line); font-size: 0.92rem; }
.site-footer .brand { color: var(--paper); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr; gap: 3rem; padding-bottom: 3.5rem; }
.footer-grid nav, .footer-grid > div:last-child { display: flex; flex-direction: column; gap: 0.55rem; }
.footer-grid a { text-decoration: none; transition: color 0.2s; }
.footer-grid a:hover, .footer-legal a:hover { color: var(--gold-soft); }
.footer-title { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(247, 243, 232, 0.4); margin-bottom: 0.5rem; }
.footer-tagline { margin-top: 1.2rem; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--paper); }
.footer-tagline em { color: var(--gold-soft); }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; padding-top: 1.75rem; border-top: 1px solid var(--ink-line); font-size: 0.78rem; color: rgba(247, 243, 232, 0.45); }
.footer-legal a { text-decoration: none; }

/* ---------- Apparition au défilement (activée par site.js) ---------- */
.js .reveal { opacity: 0; transform: translateY(1.75rem); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--reveal-delay, 0s); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .code-panel.reveal { transform: translateY(1.75rem) rotate(1.6deg); }
.js .code-panel.reveal.is-visible { transform: rotate(1.6deg); }
.js .code-panel.reveal.is-visible:hover { transform: rotate(0deg); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    .caret, .status-live::before { animation: none; }
}

/* ---------- Écrans étroits ---------- */
@media (max-width: 991.98px) {
    .hero-grid, .split { grid-template-columns: minmax(0, 1fr); }
    .code-panel { transform: none !important; }
    .site-nav { align-items: flex-start; padding-top: 1rem; }
    .numbered-list > li { grid-template-columns: 3rem minmax(0, 1fr); }
    .numbered-list > li p { grid-column: 2; }
    .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; }
    .admin-table thead { display: none; }
    .admin-table td { display: block; border: 0; padding: 0.3rem 0.75rem; }
    .admin-table tr { display: block; padding-block: 0.9rem; border-bottom: 1px solid var(--line); }
    .admin-actions { justify-content: flex-start; }
}
