/* /auteur/perception-ia : score de sentiment des réponses IA.
   S'appuie sur auteur.css (jetons --auteur-*, typographie de .auteur-page).
   Une seule surface, sections séparées par des filets : pas de carte claire. */

html.auteur-theme .perception-page {
    /* Le H1 suit de près le bandeau de veille. Sur mobile, le site laisse déjà 14 px sous le bandeau. */
    padding-top: clamp(6px, 2.2vw, 32px);
}

html.auteur-theme .perception-page ul,
html.auteur-theme .perception-page ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

html.auteur-theme .perception-page li {
    padding: 0;
}

html.auteur-theme .perception-page h1 {
    font-size: clamp(2.2rem, 4.6vw, 3.6rem);
    letter-spacing: -0.035em;
    line-height: 1.04;
    max-width: 18ch;
    text-wrap: balance;
}

html.auteur-theme .perception-hero .lead {
    color: var(--auteur-muted);
    font-size: 1.05rem;
    margin: 24px 0 0;
    max-width: 62ch;
}

/* Chiffres clés : une rangée entre deux filets. */
html.auteur-theme .perception-figures {
    border-bottom: 1px solid var(--auteur-border);
    border-top: 1px solid var(--auteur-border);
    margin: 48px 0 0;
    padding: 28px 0 24px;
}

html.auteur-theme .perception-figures dl {
    display: grid;
    gap: 24px 32px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin: 0;
}

html.auteur-theme .perception-figures dt {
    color: var(--auteur-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

html.auteur-theme .perception-figures dd {
    margin: 0;
}

html.auteur-theme .perception-figure {
    color: var(--auteur-heading);
    font-family: var(--font-serif-stack);
    line-height: 1.1;
    margin-top: 6px !important;
}

html.auteur-theme .perception-figure strong {
    font-size: clamp(2.2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

html.auteur-theme .perception-figure span {
    color: var(--auteur-muted);
    font-size: 1rem;
    margin-left: 2px;
}

html.auteur-theme .perception-figure--date {
    font-size: 1.35rem;
    font-weight: 600;
    padding-top: 10px;
}

html.auteur-theme .perception-note {
    color: var(--auteur-soft);
    font-size: 0.8rem;
}

html.auteur-theme .perception-tones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 24px !important;
}

html.auteur-theme .perception-tone {
    align-items: baseline;
    color: var(--auteur-muted);
    display: inline-flex;
    font-size: 0.85rem;
    gap: 6px;
}

html.auteur-theme .perception-tone::before {
    background: currentColor;
    border-radius: 50%;
    content: "";
    display: inline-block;
    height: 8px;
    transform: translateY(-1px);
    width: 8px;
}

html.auteur-theme .perception-tone strong {
    color: var(--auteur-heading);
}

html.auteur-theme .perception-tone--very_positive { color: oklch(0.45 0.12 150); }
html.auteur-theme .perception-tone--positive { color: oklch(0.58 0.11 150); }
html.auteur-theme .perception-tone--neutral { color: oklch(0.58 0.01 250); }
html.auteur-theme .perception-tone--negative { color: oklch(0.58 0.13 45); }
html.auteur-theme .perception-tone--very_negative { color: oklch(0.45 0.16 25); }

html.auteur-theme .perception-section {
    border-top: 1px solid var(--auteur-border);
    margin: 64px 0 0;
    padding-top: 40px;
}

/* Les chiffres clés portent déjà le filet du haut. */
html.auteur-theme .perception-figures + .perception-section {
    border-top: 0;
    margin-top: 0;
}

html.auteur-theme .perception-section > p {
    color: var(--auteur-muted);
    max-width: 68ch;
}

/* Graphique SVG dessiné côté serveur. */
html.auteur-theme .perception-chart {
    margin: 28px 0 0;
    overflow-x: auto;
    position: relative;
}

html.auteur-theme .perception-chart svg {
    display: block;
    height: auto;
    max-width: 100%;
    min-width: 600px;
    overflow: visible;
    width: 100%;
}

html.auteur-theme .perception-grid {
    stroke: var(--auteur-border);
    stroke-width: 1;
}

html.auteur-theme .perception-axis {
    fill: var(--auteur-soft);
    font-family: var(--font-sans-stack);
    font-size: 14px;
}

html.auteur-theme .perception-series polyline {
    fill: none;
    stroke: currentColor;
    stroke-linejoin: round;
    stroke-width: 2.5;
}

html.auteur-theme .perception-series circle {
    fill: currentColor;
    stroke: var(--auteur-bg);
    stroke-width: 2;
}

html.auteur-theme .perception-series--google_ai_mode { color: var(--auteur-accent); }
html.auteur-theme .perception-series--google_ai_overview { color: var(--auteur-heading); }
html.auteur-theme .perception-series--chatgpt { color: var(--auteur-clay-dark); }

html.auteur-theme .perception-legend {
    color: var(--auteur-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.8rem;
    gap: 8px 24px;
    margin-top: 12px;
}

html.auteur-theme .perception-legend__item {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

html.auteur-theme .perception-legend__mark {
    background: currentColor;
    border-radius: 2px;
    display: inline-block;
    height: 3px;
    width: 20px;
}

/* Tableau : la version lisible et indexable du graphique. */
html.auteur-theme .perception-table-wrap {
    margin-top: 32px;
    overflow-x: auto;
}

html.auteur-theme .perception-table {
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 480px;
    width: 100%;
}

/* Le style global des tableaux pose un fond blanc et un en-tête bleuté : une seule surface ici. */
html.auteur-theme .perception-table,
html.auteur-theme .perception-table thead,
html.auteur-theme .perception-table tbody,
html.auteur-theme .perception-table tr,
html.auteur-theme .perception-table th,
html.auteur-theme .perception-table td {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

html.auteur-theme .perception-table caption {
    color: var(--auteur-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding-bottom: 8px;
    text-align: left;
    text-transform: uppercase;
}

html.auteur-theme .perception-table th,
html.auteur-theme .perception-table td {
    border-bottom: 1px solid var(--auteur-border);
    padding: 10px 12px 10px 0;
    text-align: left;
}

html.auteur-theme .perception-table th {
    color: var(--auteur-heading);
    font-weight: 600;
}

html.auteur-theme .perception-table td:nth-child(3),
html.auteur-theme .perception-table td:nth-child(4),
html.auteur-theme .perception-table th:nth-child(3),
html.auteur-theme .perception-table th:nth-child(4) {
    text-align: right;
}

/* Extraits des dernières réponses. */
html.auteur-theme .perception-excerpts {
    display: grid;
    gap: 28px;
    margin-top: 28px !important;
}

html.auteur-theme .perception-excerpt__meta {
    color: var(--auteur-soft);
    font-size: 0.8rem;
    margin: 0 0 8px;
}

html.auteur-theme .perception-excerpts blockquote {
    background: none;
    border-radius: 0;
    box-shadow: none;
    font-style: normal;
    quotes: none;
    border-left: 2px solid var(--auteur-accent);
    color: var(--auteur-text);
    font-family: var(--font-serif-stack);
    font-size: 1.05rem;
    line-height: 1.55;
    margin: 0;
    max-width: 70ch;
    padding: 0 0 0 20px;
}

/* Méthode : intitulés à gauche, texte à droite sur grand écran. */
html.auteur-theme .perception-method {
    margin: 28px 0 0;
}

html.auteur-theme .perception-method > div {
    border-top: 1px solid var(--auteur-border);
    display: grid;
    gap: 6px 32px;
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 0;
}

html.auteur-theme .perception-method dt {
    color: var(--auteur-heading);
    font-weight: 600;
}

html.auteur-theme .perception-method dd {
    color: var(--auteur-muted);
    margin: 0;
    max-width: 68ch;
}

html.auteur-theme .perception-rubric {
    display: grid;
    gap: 8px;
}

html.auteur-theme .perception-rubric strong {
    color: var(--auteur-heading);
}

@media (min-width: 860px) {
    html.auteur-theme .perception-method > div {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

/* Limites : la liste à filets de /auteur, sans coche. */
html.auteur-theme .perception-excerpts blockquote::before,
html.auteur-theme .perception-excerpts blockquote::after {
    content: none;
}

html.auteur-theme .auteur-page .proof-list.perception-limits li::before {
    content: "–";
}

html.auteur-theme .perception-empty {
    border-bottom: 1px solid var(--auteur-border);
    border-top: 1px solid var(--auteur-border);
    color: var(--auteur-muted);
    margin: 48px 0 0;
    padding: 24px 0;
}

@media (max-width: 720px) {
    html.auteur-theme .perception-page .proof-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Survol du graphique : une bande par jour, un curseur et une infobulle encre. */
html.auteur-theme .perception-hit {
    cursor: crosshair;
    fill: transparent;
    outline: none;
}

html.auteur-theme .perception-hit:focus-visible {
    stroke: var(--auteur-accent);
    stroke-dasharray: 4 4;
    stroke-width: 1.5;
}

html.auteur-theme .perception-cursor {
    stroke: var(--auteur-muted);
    stroke-dasharray: 3 4;
    stroke-width: 1;
}

html.auteur-theme .perception-tooltip {
    background: var(--auteur-heading);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
    color: var(--auteur-bg);
    display: grid;
    font-size: 0.75rem;
    gap: 4px;
    line-height: 1.35;
    min-width: 220px;
    padding: 10px 12px;
    pointer-events: none;
    position: absolute;
    z-index: 2;
}

html.auteur-theme .perception-tooltip[hidden] {
    display: none;
}

html.auteur-theme .perception-tooltip__date {
    font-weight: 700;
}

html.auteur-theme .perception-tooltip__row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto auto;
}

html.auteur-theme .perception-tooltip__label {
    white-space: nowrap;
}

html.auteur-theme .perception-tooltip__score {
    font-weight: 700;
}

html.auteur-theme .perception-tooltip__count {
    opacity: 0.75;
}

/* Extrait cliquable : même lecture qu'une citation, ouvre la réponse complète. */
html.auteur-theme .perception-excerpt {
    background: none;
    border: 0;
    border-left: 2px solid var(--auteur-accent);
    border-radius: 0;
    color: var(--auteur-text);
    cursor: pointer;
    display: block;
    font: inherit;
    margin: 0;
    max-width: 70ch;
    padding: 0 0 0 20px;
    text-align: left;
    width: 100%;
}

html.auteur-theme .perception-excerpt__quote {
    display: block;
    font-family: var(--font-serif-stack);
    font-size: 1.05rem;
    line-height: 1.55;
}

html.auteur-theme .perception-excerpt__more {
    color: var(--auteur-accent);
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}

html.auteur-theme .perception-excerpt:hover .perception-excerpt__quote,
html.auteur-theme .perception-excerpt:focus-visible .perception-excerpt__quote {
    color: var(--auteur-heading);
}

html.auteur-theme .perception-excerpt:hover .perception-excerpt__more,
html.auteur-theme .perception-excerpt:focus-visible .perception-excerpt__more {
    text-decoration: underline;
}

html.auteur-theme .perception-excerpt:focus-visible {
    outline: 2px solid var(--auteur-accent);
    outline-offset: 4px;
}

/* Popup de la réponse complète. */
html.auteur-theme .perception-dialog {
    background: var(--auteur-bg);
    border: 1px solid var(--auteur-border);
    border-radius: 6px;
    box-shadow: 0 24px 60px rgb(0 0 0 / 0.25);
    color: var(--auteur-text);
    max-height: min(85vh, 900px);
    max-width: 760px;
    overflow: auto;
    padding: 0;
    width: calc(100% - 32px);
}

html.auteur-theme .perception-dialog::backdrop {
    background: rgb(20 20 25 / 0.5);
}

html.auteur-theme .perception-dialog__inner {
    padding: 24px clamp(20px, 4vw, 36px) 32px;
}

html.auteur-theme .perception-dialog__head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

html.auteur-theme .perception-dialog__meta {
    color: var(--auteur-soft);
    font-size: 0.8rem;
    margin: 6px 0 0;
}

html.auteur-theme .perception-dialog__close {
    background: none;
    border: 0;
    color: var(--auteur-heading);
    cursor: pointer;
    font-size: 1.8rem;
    line-height: 1;
    padding: 0 4px;
}

html.auteur-theme .perception-dialog h3 {
    margin: 12px 0 8px;
}

html.auteur-theme .perception-dialog__question {
    color: var(--auteur-muted);
    font-style: italic;
    margin: 0 0 20px;
}

html.auteur-theme .perception-dialog__body p {
    margin: 0 0 12px;
}

html.auteur-theme .perception-dialog__loading,
html.auteur-theme .perception-dialog__error {
    color: var(--auteur-muted);
}

html.auteur-theme .perception-dialog__sources {
    border-top: 1px solid var(--auteur-border);
    margin-top: 24px;
    padding-top: 16px;
}

html.auteur-theme .perception-dialog__sources h4 {
    color: var(--auteur-heading);
    font-size: 0.85rem;
    margin: 0 0 10px;
}

html.auteur-theme .perception-dialog__sources ol {
    display: grid;
    gap: 8px;
}

html.auteur-theme .perception-dialog__sources li {
    font-size: 0.85rem;
}

html.auteur-theme .perception-dialog__domain {
    color: var(--auteur-soft);
    margin-left: 8px;
}
