/* Texte — modèle canonique ; son emploi : canon_text.md. */

@layer components {
    .title {
        font-family: var(--canon-font-figura);
        font-size: var(--canon-size-title);
        font-weight: var(--title-weight, var(--canon-weight-title));
        line-height: var(--canon-leading-title);
        text-align: var(--title-align, inherit);
        text-transform: inherit;
        color: var(--title-ink, var(--canon-theme-ink));
    }
}

@layer components {
    .title--size-display {
        font-size: var(--canon-size-display);
    }
    .title--size-headline {
        font-size: var(--canon-size-headline);
    }
    .title--size-subtitle {
        font-size: var(--canon-size-subtitle);
    }
    .title--size-body {
        font-size: var(--canon-size-body);
    }
    .title--size-control {
        font-size: var(--canon-size-control);
    }
    .title--size-note {
        font-size: var(--canon-size-note);
    }
}

@layer components {
    .title {
        padding: var(--title-padding, 0px);
    }

    .title {
        border-block: var(--title-line-width, 0px) solid var(--title-line, transparent);
        background-color: var(--title-surface, transparent);
    }
}

@layer components {
    .reading {
        max-width: var(--canon-width-reading, none);
    }

    .reading {
        line-height: var(--canon-leading-reading);
    }
}

@layer components {
    .link {
        padding: 0;
    }

    .link {
        border: 0;
        background: var(--link-surface, transparent);
    }
    .link:hover {
        background-color: var(--link-surface-hover, var(--link-surface, transparent));
    }
    /* Pressé, le lien se surligne d'une teinte de l'action, qui déborde le texte sans le déplacer. */
    .link:is(:any-link, button:where(:enabled)):active {
        border-radius: var(--canon-radius-control);
        background-color: var(--link-surface-active, color-mix(in oklab, var(--canon-theme-action) 24%, transparent));
        box-shadow: 0 0 0 0.15em var(--link-surface-active, color-mix(in oklab, var(--canon-theme-action) 24%, transparent));
    }

    .link {
        font: inherit;
        color: var(--link-ink, var(--canon-theme-action));
        text-decoration-line: var(--link-decoration, underline);
        text-decoration-style: var(--link-line-style, solid);
        text-underline-offset: var(--link-underline-offset, auto);
    }
    .link:hover {
        color: var(--link-ink-hover, var(--canon-theme-action-hover));
        text-decoration-line: underline;
        text-decoration-style: solid;
    }
    /* Le surlignage remplace le soulignement ; il porte la couleur, le texte prend l'encre, lisible
       sur lui sous tous les thèmes. */
    .link:is(:any-link, button:where(:enabled)):active {
        color: var(--link-ink-active, var(--canon-theme-ink));
        text-decoration-line: none;
    }

    .link {
        cursor: pointer;
    }
}

@layer components {
    .link--style-subtle {
        color: inherit;
        text-decoration-line: none;
    }
    .link--style-subtle:is(:hover, [aria-expanded="true"]) {
        text-decoration-line: underline;
    }
}

@layer components {
    .stat {
        font-family: var(--canon-font-figura);
        font-size: var(--canon-size-title);
        font-weight: var(--stat-weight, var(--canon-weight-title));
        font-variant-numeric: tabular-nums;
        line-height: var(--canon-leading-title);
    }
}

@layer components {
    .stat--size-headline {
        font-size: var(--canon-size-headline);
    }
    .stat--size-subtitle {
        font-size: var(--canon-size-subtitle);
    }
    .stat--size-body {
        font-size: var(--canon-size-body);
    }
}

@layer components {
    :where([data-trend="rise"]) {
        color: var(--trend-rise-ink, inherit);
    }
    :where([data-trend="fall"]) {
        color: var(--trend-fall-ink, inherit);
    }
}

@layer utilities {
    .u-muted {
        color: var(--canon-theme-muted);
    }
    .u-faint {
        color: var(--canon-theme-faint);
    }
    .u-note {
        font-size: var(--canon-size-note);
    }
    .u-numeric {
        font-variant-numeric: tabular-nums;
    }
    .u-raw {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }
}

@layer utilities {
    .u-truncate {
        overflow: hidden;
    }
    .u-clamp {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
    }
    .u-truncate {
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .u-clamp {
        -webkit-line-clamp: 3;
    }
    .u-nowrap {
        white-space: nowrap;
    }
}

@layer utilities {
    .u-subtitle {
        font-size: var(--canon-size-subtitle);
    }
    .u-control {
        font-size: var(--canon-size-control);
    }
    .u-fine {
        font-size: var(--canon-size-fine);
    }
    .u-leading-body {
        line-height: var(--canon-leading-body);
    }
    .u-capitals {
        letter-spacing: var(--canon-tracking-capitals);
        text-transform: uppercase;
    }
}

@layer utilities {
    .u-weight-quiet {
        font-weight: var(--canon-weight-quiet);
    }
    .u-weight-label {
        font-weight: var(--canon-weight-label);
    }
    .u-weight-title {
        font-weight: var(--canon-weight-title);
    }
    .u-weight-emphasis {
        font-weight: var(--canon-weight-emphasis);
    }
}

/* Part locale — les réglages que l'app pose sur cet objet, contexte par contexte. */

@layer components {
    /* Les titres d'Exavoris dans un graphique, une carte, un panneau : à la police du texte, sauf la
       désignation d'une version ; leurs intitulés, petits et pâles. */
    .chart-title {
        --title-weight: var(--canon-weight-label);
    }
    /* Les liens et boutons d'Exavoris : le lien d'une catégorie, sans soulignement au repos ; le bouton
       « Détails », cerclé en pilule ; l'engrenage d'un graphique, discret, relevé au survol et ouvert. */
    .category-link {
        --link-decoration: none;
    }
}

@layer components {
    /* Le nom d'une société, sous son symbole : un sous-titre fin, atténué. */
    .analysis-head-name {
        --title-weight: var(--canon-weight-body);
    }
    /* Le nom d'un élément de la messagerie, au corps tant qu'il est lu ; la tête d'une version, au corps ;
       le titre d'une décomposition, à la graisse d'un libellé. */
    .inbox-item-title,
    .configurator-version-head {
        --title-weight: var(--canon-weight-body);
    }
    .inbox-item[data-inbox-unread] .inbox-item-title {
        --title-weight: var(--canon-weight-title);
    }
    .composer-decomposition-title {
        --title-weight: var(--canon-weight-label);
    }
    /* Les intitulés d'un pop-up, d'un bloc ou d'une jauge, publiés en surtitres : à la graisse du texte et à
       l'encre faint ; le titre d'une thèse, à la graisse du texte. */
    .moat-popover-title,
    .layer-aside-head,
    .scoring-sources-head,
    .sector-popover-title {
        --title-weight: var(--canon-weight-body);
        --title-ink: var(--canon-theme-faint);
    }
    .analysis-thesis-head > .title {
        --title-weight: var(--canon-weight-body);
    }
}

@layer components {
    /* Le sens d'une variation, à l'encre des données : une hausse, une baisse. Une carte ou un panneau qui
       porte le sens pour son accent garde l'encre de son texte. */
    [data-trend]:not(.card, .panel) {
        --trend-rise-ink: var(--local-color-data-rise);
        --trend-fall-ink: var(--local-color-data-fall);
    }
    /* La note d'une composition, son unité à la graisse du texte ; la pondération d'une ligne, à la famille
       des chiffres seule. */
    .composer-score,
    .composer-weighting-value {
        --stat-weight: var(--canon-weight-body);
    }
    /* La tête d'une colonne du filtre sectoriel : un bandeau à la teinte de son niveau, que le script
       mêle au fond ; le violet du niveau le plus abstrait en repli. */
    .sector-filter-column-head {
        --title-surface: color-mix(in srgb, var(--local-color-data-series-4) 26%, var(--canon-theme-surface));
        --title-padding: 6px 10px 5px;
    }
}
