/* ==========================================================================
   Pages projet : étude de cas en une colonne de lecture
   (s'appuie sur les variables de ../../styles.css)
   ========================================================================== */

.project-page .container {
    max-width: 46rem;
    margin: 0 auto;
    padding: 0 var(--gutter);
    box-sizing: content-box;
}

/* ---------- En-tête du projet ---------- */

.project-hero {
    padding: 3rem 0 2.5rem;
    border-bottom: 1px solid var(--line);
}

.project-hero h1 {
    margin-top: 1.75rem;
    max-width: 38rem;
    font-size: clamp(1.75rem, 3.6vw, 2.35rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.project-description {
    margin-top: 0.85rem;
    font-size: 1.12rem;
    line-height: 1.6;
    color: var(--ink-2);
}

.project-kicker {
    margin-top: 1.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-ink);
}

.project-kicker + h1 {
    margin-top: 0.6rem;
}

.project-meta,
.project-tags {
    list-style: none;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 1.5rem;
    font-size: 0.92rem;
    color: var(--ink);
}

.project-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.project-meta-item + .project-meta-item::before {
    content: "";
    width: 4px;
    height: 4px;
    margin-right: 1rem;
    margin-left: -1rem;
    border-radius: 50%;
    background: var(--line-strong);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.25rem;
}

.project-tag {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-2);
}

.project-link-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    margin-top: 1.5rem;
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--ink);
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s var(--ease-out);
}

.project-link-button:hover {
    background: var(--ink-hover);
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

.project-link-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-color: var(--line-strong);
}

/* Visuel principal, un peu plus large que la colonne de lecture */
.project-page .container-wide {
    max-width: 60rem;
}

.project-hero .project-image-container {
    margin-top: 2.5rem;
}

/* Graphique en visuel principal : taille de lecture, centré */
.cover-chart .project-image-container img {
    display: block;
    max-width: 34rem;
    margin: 0 auto;
}

.cover-chart .image-caption {
    text-align: center;
}

/* Sommaire de l'étude de cas */
.project-toc {
    padding: 1.5rem 0 0;
}

.project-toc ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
}

.project-toc a {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--ink-2);
    transition: border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.project-toc a:hover {
    border-color: var(--ink-3);
    color: var(--ink);
}

.project-section {
    scroll-margin-top: 1.5rem;
}

/* ---------- Corps de l'étude de cas ---------- */

.project-content {
    padding: 1rem 0 2rem;
}

.project-section {
    padding-top: 3rem;
}

.project-section > h2 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 650;
    letter-spacing: -0.022em;
}

.project-section p,
.project-section li {
    font-size: 1.02rem;
    line-height: 1.72;
}

.project-section p + p,
.project-section p + ul,
.project-section ul + p {
    margin-top: 1rem;
}

.project-section ul {
    margin-top: 0.75rem;
    padding-left: 1.2rem;
}

.project-section li + li {
    margin-top: 0.45rem;
}

.project-section li::marker {
    color: var(--ink-3);
}

.project-section a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

/* Figures */

.project-image-container {
    margin: 2rem 0 0;
}

.project-image-container img {
    width: 100%;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--line);
}

/* Graphiques (SVG) : fond blanc et marge intérieure pour respirer */
.project-image-container.is-chart img {
    padding: 1rem;
    background: var(--bg);
}

.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
    gap: 0 1.5rem;
}

.figure-grid .project-image-container {
    margin-top: 1.5rem;
}

/* Chiffres clés vérifiés */
.key-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(11.5rem, 100%), 1fr));
    gap: 1px;
    margin: 1.25rem 0 1.5rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line);
}

.key-figures div {
    padding: 0.9rem 1rem;
    background: var(--bg);
}

.key-figures dt {
    font-size: 0.8rem;
    color: var(--ink-3);
}

.key-figures dd {
    margin: 0.25rem 0 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.key-figures small {
    display: block;
    margin-top: 0.15rem;
    white-space: normal;
    overflow-wrap: normal;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--ink-3);
}

.image-caption {
    margin-top: 0.75rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink-3);
}

/* Tableaux de résultats */

.table-wrapper {
    margin-top: 1.5rem;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.results-table th,
.results-table td {
    padding: 0.7rem 0.9rem;
    text-align: right;
    border-bottom: 1px solid var(--line);
}

.results-table th:first-child,
.results-table td:first-child {
    text-align: left;
}

.results-table tbody th {
    /* chiffres tabulaires seulement en mono : en sans, la virgule s'élargit */
    font-variant-numeric: normal;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--ink);
}

.results-table thead th {
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
}

.results-table td {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--ink);
}

.results-table td:first-child {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    /* chiffres tabulaires seulement en mono : en sans, la virgule s'élargit */
    font-variant-numeric: normal;
}

.results-table tbody tr:last-child td {
    border-bottom: 0;
}

/* Technologies, défis, fonctionnalités */

.tech-stack {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
    gap: 0;
    margin-top: 1rem;
    border-top: 1px solid var(--line);
}

.tech-item {
    padding: 1rem 1rem 1rem 0;
    border-bottom: 1px solid var(--line);
}

.tech-item h4 {
    font-size: 0.98rem;
}

.tech-item p {
    margin-top: 0.25rem;
    font-size: 0.92rem;
    line-height: 1.6;
}

.challenge-card {
    padding: 1.25rem 0;
    border-top: 1px solid var(--line);
}

.challenge-card:first-of-type {
    margin-top: 1rem;
}

.challenge-card h4 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.challenge-card p + p {
    margin-top: 0.5rem;
}

/* Tableau descriptif (texte plutôt que mesures) */
.results-table.is-text th,
.results-table.is-text td {
    text-align: left;
    vertical-align: top;
}

.results-table.is-text td {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-variant-numeric: normal;
    color: var(--ink-2);
}

.table-note {
    margin-top: 0.75rem;
    font-size: 0.88rem;
    color: var(--ink-3);
}

/* Navigation entre études de cas */
.project-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem 0 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

.project-pager a {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    transition: background-color 0.2s var(--ease-out);
}

.project-pager a:hover {
    background: var(--surface);
}

.project-pager a[rel="next"] {
    text-align: right;
}

.project-pager span {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--ink-3);
}

/* Fin de page : lien vers les autres projets */

.page-footer .inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

@media (max-width: 640px) {
    .project-hero {
        padding-top: 2rem;
    }

    .project-meta-item + .project-meta-item::before {
        display: none;
    }

    .project-meta {
        flex-direction: column;
        gap: 0.35rem;
    }

    .project-pager {
        grid-template-columns: 1fr;
    }

    .project-pager a[rel="next"] {
        text-align: left;
    }
}
