/*
 * SENZA Formations - public blog article page.
 *
 * Page level rules of the article page, loaded right after design-system.css: layout, article header,
 * body typography, table of contents, sidebar cards and the full width bands under the article.
 * Every other piece is rendered by a Sz component and is not restyled.
 *
 * main.css turns every hovered <a> and <button> yellow at 0-1-1 (see the rule in
 * design-system.css): any classed link declared below pins its own hover colour.
 */

/* =============================================================
   Layout
   ============================================================= */

/*
 * Every wrapper of the page ("sz-article-container") also carries the theme "container" class, the one
 * of the site header: the breadcrumb, the article and the bands stay aligned with the logo at every
 * breakpoint (1320px from 1200px, 15px gutters), rather than following the 1240px of the mock-up.
 *
 * The section-nav controller writes the measured height of the fixed theme header into
 * --section-nav-header-height; 90px is the value measured on desktop, used until the header is fixed.
 */
.sz-article {
    --sz-article-sticky-top: calc(var(--section-nav-header-height, 90px) + 20px);
}

.sz-article__layout {
    display: grid;
    grid-template-columns: minmax(0, 800px) 372px;
    justify-content: space-between;
    gap: 56px;
    align-items: start;
    padding-top: 40px;
    padding-bottom: 88px;
}

.sz-article__main {
    min-width: 0;
}

/* Stretched over the whole row, so the stack inside has room to stick while the article scrolls. */
.sz-article__sidebar {
    align-self: stretch;
}

/*
 * The table of contents and the e-book or call-back card stick once reached. The column never scrolls
 * by itself: the list of the table of contents below is capped instead, so the stack fits the viewport.
 */
.sz-article-sidebar {
    position: sticky;
    top: var(--sz-article-sticky-top);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* A long table of contents scrolls by itself, so the e-book card under it stays in view. */
.sz-article .sz-article-toc--sidebar > .sz-article-toc__list {
    max-height: max(160px, calc(100vh - var(--sz-article-sticky-top) - 340px));
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Below 1200px the sidebar falls under the article: its table of contents moves to the main column. */
.sz-article-toc--main {
    display: none;
}

@media (max-width: 1199px) {
    .sz-article__layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
        padding-bottom: 64px;
    }

    .sz-article-sidebar {
        position: static;
    }

    .sz-article-toc--main {
        display: block;
        margin-bottom: 36px;
    }

    .sz-article-toc--sidebar {
        display: none;
    }
}

/*
 * Scroll anchoring off for this page only. When the theme fixes its header, the browser reacts to the
 * header leaving the page flow before the section-nav placeholder takes over its height, and shifts
 * the scroll position in the middle of a smooth scroll.
 */
html {
    overflow-anchor: none;
}

/* Native anchor fallback without JavaScript: right under the fixed header, with the gap of the controller. */
.sz-article-body [id] {
    scroll-margin-top: calc(var(--section-nav-header-height, 90px) + 8px);
}

.sz-article [tabindex="-1"]:focus:not(:focus-visible) {
    outline: none;
}

/* =============================================================
   Breadcrumb
   ============================================================= */

.sz-article-breadcrumb {
    position: relative;
    overflow: hidden;
    background: var(--tg-common-color-gray-2);
}

.sz-article-breadcrumb__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-top: 18px;
    padding-bottom: 18px;
    font-size: 13.5px;
}

.sz-article-breadcrumb__link,
.sz-article-breadcrumb__link:hover {
    color: var(--tg-heading-color);
    font-weight: var(--tg-fw-medium);
}

.sz-article-breadcrumb__link:hover {
    color: var(--tg-theme-primary);
}

.sz-article-breadcrumb__separator {
    color: var(--tg-common-color-gray-4);
}

.sz-article-breadcrumb__current {
    color: var(--tg-theme-primary);
    font-weight: var(--tg-fw-medium);
}

.sz-article-breadcrumb__star {
    position: absolute;
    right: 9%;
    top: 14px;
    width: 22px;
    height: 22px;
    fill: var(--tg-theme-secondary);
}

/* =============================================================
   Article header
   ============================================================= */

.sz-article-header__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.sz-article .sz-article-header__title {
    font-size: clamp(30px, 3.6vw, 42px);
    line-height: 1.18;
    font-weight: var(--tg-fw-bold);
    letter-spacing: -0.015em;
    margin: 0 0 18px;
    text-wrap: pretty;
}

.sz-article .sz-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 14.5px;
    color: var(--tg-body-color);
    margin: 0 0 28px;
}

.sz-article-meta__author {
    color: var(--tg-heading-color);
    font-weight: var(--tg-fw-semi-bold);
}

a.sz-article-meta__author:hover {
    color: var(--tg-theme-primary);
}

.sz-article-meta__separator {
    color: var(--tg-common-color-gray-4);
}

.sz-article-header__cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--sz-radius-card);
    overflow: hidden;
    background: var(--tg-common-color-gray-2);
    margin-bottom: 24px;
}

.sz-article-header__cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sz-article-ai {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    padding: 8px 8px 8px 18px;
    border: 1px solid var(--tg-border-3);
    border-radius: var(--sz-radius-pill);
    margin-bottom: 32px;
}

.sz-article-ai__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 4px;
    font-size: 14px;
    font-weight: var(--tg-fw-semi-bold);
    color: var(--tg-heading-color);
}

.sz-article-ai__label svg {
    fill: var(--tg-theme-primary);
}

.sz-article-ai__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--sz-radius-pill);
    background: var(--tg-common-color-gray-2);
    color: var(--tg-heading-color);
    font-size: 13.5px;
    font-weight: var(--tg-fw-semi-bold);
}

.sz-article-ai__link:hover,
.sz-article-ai__link:focus-visible {
    background: var(--tg-theme-primary);
    color: var(--tg-common-color-white);
}

.sz-article-ai__link span {
    opacity: 0.7;
}

/* Too narrow for one line: the label takes its own row and the pill becomes a rounded card. */
@media (max-width: 575px) {
    .sz-article-ai {
        border-radius: var(--sz-radius-card);
        padding: 12px;
    }

    .sz-article-ai__label {
        flex-basis: 100%;
        margin: 0 0 2px 4px;
    }
}

/* The summary field is rich text: its own paragraphs take the lead style. */
.sz-article-header__lead {
    font-size: 18.5px;
    line-height: 1.65;
    font-weight: var(--tg-fw-medium);
    color: var(--tg-common-color-dark);
    text-wrap: pretty;
    padding-bottom: 36px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--tg-border-3);
}

.sz-article .sz-article-header__lead p {
    margin: 0 0 0.75em;
}

.sz-article .sz-article-header__lead > :last-child {
    margin-bottom: 0;
}

/* =============================================================
   Article body
   ============================================================= */

.sz-article-body {
    font-size: 17px;
    line-height: 1.75;
    color: var(--tg-body-color);
    overflow-wrap: break-word;
}

.sz-article .sz-article-body h2 {
    font-size: 26px;
    line-height: 1.3;
    font-weight: var(--tg-fw-semi-bold);
    margin: 48px 0 16px;
    text-wrap: pretty;
}

.sz-article .sz-article-body h3 {
    font-size: 21px;
    line-height: 1.35;
    margin: 32px 0 12px;
    text-wrap: pretty;
}

.sz-article .sz-article-body h4 {
    font-size: 18px;
    margin: 24px 0 10px;
}

.sz-article .sz-article-body > :first-child {
    margin-top: 0;
}

.sz-article .sz-article-body p {
    margin: 0 0 18px;
}

.sz-article .sz-article-body strong {
    color: var(--tg-heading-color);
    font-weight: var(--tg-fw-semi-bold);
}

.sz-article .sz-article-body ul,
.sz-article .sz-article-body ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.sz-article .sz-article-body ul {
    list-style: disc;
}

.sz-article .sz-article-body ol {
    list-style: decimal;
}

.sz-article .sz-article-body li {
    margin-bottom: 8px;
}

.sz-article .sz-article-body li::marker {
    color: var(--tg-theme-primary);
}

.sz-article .sz-article-body a:not([class]) {
    color: var(--tg-theme-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sz-article .sz-article-body a:not([class]):hover {
    color: var(--tg-common-color-blue-2);
}

.sz-article .sz-article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--sz-radius-sm);
}

.sz-article .sz-article-body blockquote {
    margin: 0 0 18px;
    padding: 20px 24px;
}

.sz-article .sz-article-body pre {
    margin: 0 0 18px;
    padding: 16px 18px;
    border-radius: var(--sz-radius-sm);
    background: var(--tg-common-color-gray-2);
    font-size: 14px;
    white-space: pre-wrap;
}

/* Wide tables scroll sideways instead of widening the page on small screens. */
.sz-article .sz-article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.55;
}

.sz-article .sz-article-body th,
.sz-article .sz-article-body td {
    border: 1px solid var(--tg-border-3);
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
}

.sz-article .sz-article-body th {
    background: var(--tg-common-color-gray-2);
    color: var(--tg-heading-color);
    font-weight: var(--tg-fw-semi-bold);
}

/* =============================================================
   Author and expert bios
   ============================================================= */

.sz-article-contributors {
    display: grid;
    /* min() lets a single card shrink below 300px on the narrowest screens instead of overflowing. */
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 20px;
    margin-top: 48px;
}

/* The "Par" and "Expertisé par" links under the title jump here, below the fixed theme header. */
.sz-article-contributor-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 26px;
    border: 1px solid var(--tg-border-3);
    border-radius: 16px;
    scroll-margin-top: var(--sz-article-sticky-top);
}

.sz-article-contributor-card--expert {
    background: var(--tg-common-color-gray-2);
}

.sz-article .sz-article-contributor-card__eyebrow {
    margin: 0;
    font-family: var(--tg-heading-font-family);
    font-weight: var(--tg-fw-semi-bold);
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tg-theme-primary);
}

.sz-article-contributor-card__identity {
    display: flex;
    gap: 16px;
    align-items: center;
}

.sz-article-contributor-card__photo {
    flex: none;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.sz-article .sz-article-contributor-card__name {
    margin: 0;
    font-family: var(--tg-heading-font-family);
    font-weight: var(--tg-fw-semi-bold);
    font-size: 18px;
    line-height: 1.25;
    color: var(--tg-heading-color);
}

.sz-article .sz-article-contributor-card__role {
    margin: 3px 0 0;
    font-size: 14px;
    color: var(--tg-body-color);
}

.sz-article .sz-article-contributor-card__bio {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: var(--tg-body-color);
}

.sz-article-contributor-card__linkedin {
    align-self: flex-start;
}

/* As on the mock-up, the button lets the grey of the expert card show through until hovered. */
.sz-article-contributor-card--expert .sz-article-contributor-card__linkedin:not(:hover):not(:focus-visible) {
    background: transparent;
}

/* =============================================================
   Sidebar cards
   ============================================================= */

.sz-article .sz-article-sidebar-card {
    padding: 18px 22px;
    border: 1px solid var(--tg-border-3);
    border-radius: var(--sz-radius-card);
    background: var(--tg-common-color-white);
}

/* Table of contents */

.sz-article .sz-article-toc {
    padding-bottom: 14px;
}

.sz-article .sz-article-toc__title {
    font-family: var(--tg-heading-font-family);
    font-weight: var(--tg-fw-semi-bold);
    font-size: 16px;
    color: var(--tg-heading-color);
    margin: 0 0 8px;
}

.sz-article .sz-article-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sz-article .sz-article-toc__list--nested {
    padding-left: 18px;
}

.sz-article-toc__link,
.sz-article-toc__link:hover {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    font-size: 14.5px;
    line-height: 1.4;
    color: var(--tg-body-color);
}

.sz-article-toc__link:hover {
    color: var(--tg-theme-primary);
}

/* The dot of the mock-up, only lit on the section being read. */
.sz-article-toc__link::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tg-theme-primary);
    opacity: 0;
    transform: translateY(-2px);
}

.sz-article-toc__link--nested {
    font-size: 13.5px;
}

.sz-article-toc__link--active,
.sz-article-toc__link--active:hover {
    color: var(--tg-heading-color);
    font-weight: var(--tg-fw-semi-bold);
}

.sz-article-toc__link--active::before {
    opacity: 1;
}

/* E-book */

.sz-article .sz-article-ebook {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 22px;
    border: 0;
    background: var(--tg-common-color-gray-2);
}

.sz-article-ebook__summary {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sz-article-ebook__cover {
    flex: none;
    width: 84px;
    height: 112px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--tg-common-color-white);
    box-shadow: 4px 4px 0 0 var(--tg-common-color-blue);
}

.sz-article-ebook__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sz-article-ebook__text {
    min-width: 0;
}

.sz-article .sz-article-ebook__eyebrow {
    margin: 0;
    font-size: 11.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: var(--tg-fw-semi-bold);
    color: var(--tg-theme-primary);
}

.sz-article .sz-article-ebook__title {
    margin: 5px 0 0;
    font-family: var(--tg-heading-font-family);
    font-weight: var(--tg-fw-semi-bold);
    font-size: 15.5px;
    line-height: 1.35;
    color: var(--tg-heading-color);
    text-wrap: pretty;
}

.sz-article .sz-article-ebook__subtitle {
    margin: 6px 0 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--tg-body-color);
}

/* Contact card, when the category has no e-book: same treatment as the e-book card */

.sz-article .sz-article-contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 22px;
    border: 0;
    background: var(--tg-common-color-gray-2);
}

.sz-article .sz-article-contact__title {
    font-family: var(--tg-heading-font-family);
    font-weight: var(--tg-fw-semi-bold);
    font-size: 16px;
    line-height: 1.35;
    color: var(--tg-heading-color);
    margin: 0;
}

.sz-article .sz-article-contact__intro {
    font-size: 14px;
    line-height: 1.55;
    color: var(--tg-body-color);
    margin: 0 0 8px;
}

/* =============================================================
   Full width bands under the article
   ============================================================= */

.sz-article-band {
    background: var(--tg-common-color-white);
}

.sz-article-band--muted {
    background: var(--tg-common-color-gray-2);
}

.sz-article-band__inner {
    padding-top: 72px;
    padding-bottom: 72px;
}

.sz-article .sz-article-band__title {
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.25;
    font-weight: var(--tg-fw-bold);
    margin: 0 0 10px;
}

.sz-article .sz-article-band__intro {
    font-size: 16px;
    color: var(--tg-body-color);
    margin: 0 0 28px;
}

/* Without an intro, the title sits right above the grid. */
.sz-article .sz-article-band__title:has(+ .sz-article-related-grid) {
    margin-bottom: 28px;
}

@media (max-width: 767px) {
    .sz-article-band__inner {
        padding-top: 56px;
        padding-bottom: 56px;
    }
}

/* Related articles */

.sz-article-related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 991px) {
    .sz-article-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .sz-article-related-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.sz-article-related-card,
.sz-article-related-card:hover {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tg-border-3);
    border-radius: var(--sz-radius-card);
    overflow: hidden;
    background: var(--tg-common-color-white);
    color: var(--tg-heading-color);
    transition: all 0.25s ease;
}

.sz-article-related-card:hover {
    border-color: var(--tg-theme-primary);
    box-shadow: var(--sz-shadow-card);
}

.sz-article-related-card__image {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--tg-common-color-gray-2);
}

.sz-article-related-card__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sz-article-related-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 20px 22px 22px;
}

.sz-article-related-card__badge {
    align-self: flex-start;
    margin-bottom: 12px;
}

.sz-article-related-card__title {
    font-family: var(--tg-heading-font-family);
    font-weight: var(--tg-fw-bold);
    font-size: 16.5px;
    line-height: 1.35;
    color: var(--tg-heading-color);
    margin-bottom: 10px;
}

.sz-article-related-card__meta {
    margin-top: auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--tg-common-color-gray-3);
}
