/*
 * CMS do site público — páginas (public/templates/cms_page_detail.html) e blocos (public/templates/cms/blocks/).
 *
 * O site usa o tema TheSaaS (classes Bootstrap 4: mr-/ml-, float-right...). Tudo o que é próprio do CMS
 * fica com prefixo .cms- para não mexer no resto do site. As cores vêm dos tokens do tema
 * (--cz-theme-*, definidos em Aparência › Tema); sem tokens, ficam os valores de sempre.
 */

/* Reading experience — scoped to .cms-content so the rest of the site is untouched */
.cms-content { max-width: 72ch; margin-inline: auto; font-size: 1.0625rem; line-height: 1.7; }
.cms-content > :first-child { margin-top: 0; }
.cms-content h2, .cms-content h3, .cms-content h4 {
    margin-top: 2.25rem; margin-bottom: .75rem; font-weight: 600; line-height: 1.25;
    scroll-margin-top: 120px; /* anchor jumps clear the fixed topbar/navbar */
}
.cms-content h2 { font-size: 1.75rem; }
.cms-content h3 { font-size: 1.4rem; }
.cms-content p { margin-bottom: 1.15rem; }
.cms-content img { max-width: 100%; height: auto; border-radius: .5rem; margin: 1.5rem 0; }
.cms-content blockquote {
    border-left: .25rem solid #50a1ff; margin: 1.5rem 0; padding: .5rem 1.25rem;
    color: #555; font-style: italic; background: #fafbfb; border-radius: 0 .5rem .5rem 0;
}
.cms-content ul, .cms-content ol { margin-bottom: 1.15rem; padding-left: 1.5rem; }
.cms-content li { margin-bottom: .4rem; }
.cms-content pre {
    background: #1e1e24; color: #f1f1f1; padding: 1rem 1.25rem; border-radius: .5rem;
    overflow-x: auto; font-size: .9rem; margin: 1.5rem 0;
}
.cms-content code { background: #f0f1f3; padding: .15rem .4rem; border-radius: .25rem; font-size: .9em; }
.cms-content pre code { background: transparent; padding: 0; }
.cms-content table {
    width: 100%; margin: 1.5rem 0; border-collapse: collapse; font-size: .95rem;
    display: block; overflow-x: auto; /* wide tables scroll on mobile */
}
.cms-content th, .cms-content td { border: 1px solid #e5e7eb; padding: .6rem .9rem; text-align: left; }
.cms-content thead th { background: #fafbfb; }
.cms-content a { color: var(--cz-cms-link, #2c7be5); text-decoration: underline; }

/* Table of contents (auto-built, hidden until populated) */
.cms-toc { background: #fafbfb; border: 1px solid #eef0f2; border-radius: .5rem; padding: 1rem 1.25rem; margin-bottom: 2rem; }
.cms-toc-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #888; margin-bottom: .5rem; }
.cms-toc ul { list-style: none; margin: 0; padding: 0; }
.cms-toc li { margin-bottom: .35rem; }
.cms-toc li.cms-toc-h3 { padding-left: 1rem; font-size: .92rem; }
.cms-toc a { color: #555; text-decoration: none; }
.cms-toc a:hover { color: var(--cz-cms-link, #2c7be5); }

/* Back to top (namespaced so it does not collide with the theme .scroll-top) */
.cms-back-to-top {
    position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px;
    border-radius: 50%; border: 0; background: var(--cz-cms-link, #2c7be5); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
    box-shadow: 0 4px 14px rgba(0,0,0,.18); opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease; z-index: 1030; cursor: pointer;
}
.cms-back-to-top.is-visible { opacity: 1; visibility: visible; }

/* Share row */
.cms-share { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 2.5rem 0 0; }
.cms-share .btn { display: inline-flex; align-items: center; gap: .4rem; }

/* ── Imagens: alinhamento e legendas (editor e blocos) ──────────────────────── */
.cms-content figure, figure.cms-figure { margin: 1.5rem 0; }
figure.cms-figure img { margin: 0; }
.cms-content figcaption, figure.cms-figure > figcaption {
    margin-top: .5rem; font-size: .875rem; color: #6c757d; text-align: center;
}
.cms-align-center { margin-left: auto; margin-right: auto; text-align: center; }
.cms-align-center img { margin-left: auto; margin-right: auto; display: block; }
.cms-align-left { float: left; max-width: 50%; margin: .25rem 1.5rem 1rem 0; }
.cms-align-right { float: right; max-width: 50%; margin: .25rem 0 1rem 1.5rem; }
.cms-align-wide { max-width: min(1140px, 100vw - 2rem); margin-left: 50%; transform: translateX(-50%); width: min(1140px, 100vw - 2rem); }
.cms-align-full { width: 100vw; max-width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.cms-align-full img, .cms-align-wide img { width: 100%; border-radius: 0; }
@media (max-width: 575.98px) {
    .cms-align-left, .cms-align-right { float: none; max-width: 100%; margin: 1rem 0; }
}
.cms-clearfix::after { content: ''; display: table; clear: both; }

/* ── Blocos (public/templates/cms/blocks/) ──────────────────────────────────── */
.cms-block { position: relative; }
.cms-block + .cms-block { margin-top: 0; }
.cms-section { padding-top: var(--cms-section-pad, 3rem); padding-bottom: var(--cms-section-pad, 3rem); }
.cms-pad-none { --cms-section-pad: 0; }
.cms-pad-sm { --cms-section-pad: 1.5rem; }
.cms-pad-md { --cms-section-pad: 3rem; }
.cms-pad-lg { --cms-section-pad: 5rem; }
.cms-bg-light { background: #f7f9fc; }
.cms-bg-dark { background: #141824; color: rgba(255, 255, 255, .85); }
.cms-bg-dark h1, .cms-bg-dark h2, .cms-bg-dark h3, .cms-bg-dark h4 { color: #fff; }
.cms-bg-primary { background: var(--cz-theme-primary, #0575e2); color: #fff; }
.cms-bg-primary h1, .cms-bg-primary h2, .cms-bg-primary h3, .cms-bg-primary h4 { color: #fff; }
@media (max-width: 767.98px) {
    .cms-hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
    .cms-hide-desktop { display: none !important; }
}
.cms-boxed { border-radius: .75rem; }
.cms-layout--full_width > .cms-block:first-child.cms-block--hero,
.cms-layout--landing > .cms-block:first-child.cms-block--hero { margin-top: 0; }

/* Citação */
.cms-quote { margin: 2rem 0; }
.cms-quote__cite { font-size: .9rem; color: #6c757d; font-style: normal; }
.cms-quote--large { border-left: 0; background: transparent; text-align: center; font-size: 1.5rem; line-height: 1.5; padding: 1rem 0; }
.cms-content blockquote.cms-quote--large { border-left: 0; background: transparent; }

/* Separador */
.cms-sep { border-top: 1px solid #e5e7eb; }
.cms-sep--sm { margin: 1rem 0; }
.cms-sep--md { margin: 2.5rem 0; }
.cms-sep--lg { margin: 4rem 0; }
.cms-space--sm { height: 1.5rem; }
.cms-space--md { height: 3rem; }
.cms-space--lg { height: 6rem; }

/* Botões */
.cms-buttons { margin-top: 1.5rem; }
.cms-buttons .btn { text-decoration: none; }
.cms-content .cms-buttons a.btn { text-decoration: none; }

/* Galeria */
.cms-gallery { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1.5rem 0; }
@media (min-width: 768px) {
    .cms-gallery--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cms-gallery--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cms-gallery--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .cms-gallery--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.cms-gallery__item { margin: 0; }
.cms-gallery__img, .cms-content .cms-gallery__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .5rem; margin: 0; }
.cms-gallery figcaption { font-size: .8rem; color: #6c757d; margin-top: .35rem; }

/* Vídeo */
.cms-video iframe { border: 0; }

/* Destaque (hero) */
.cms-hero { position: relative; overflow: hidden; display: flex; align-items: center; color: #fff;
    background: linear-gradient(135deg, var(--cz-theme-primary, #0575e2), #0b1330); border-radius: .75rem; }
.cms-layout--full_width .cms-hero, .cms-layout--landing .cms-hero { border-radius: 0; }
.cms-hero--sm { min-height: 280px; }
.cms-hero--md { min-height: 420px; }
.cms-hero--lg { min-height: 600px; }
.cms-hero--full { min-height: 100vh; }
.cms-hero__bg, .cms-content img.cms-hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; max-width: none; }
.cms-hero__overlay { position: absolute; inset: 0; background: #000; }
.cms-hero__content { position: relative; z-index: 1; padding-top: 3rem; padding-bottom: 3rem; }
.cms-hero__title { color: #fff; font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 700; line-height: 1.15; margin: 0 0 1rem; }
.cms-hero__subtitle { font-size: 1.2rem; opacity: .9; margin-bottom: 0; }
.cms-hero .btn-outline-primary { color: #fff !important; border-color: #fff !important; }

/* Colunas */
.cms-column > :first-child { margin-top: 0; }
@media (max-width: 767.98px) { .cms-column + .cms-column { margin-top: 1.5rem; } }

/* Chamada à ação */
.cms-cta { border-radius: .75rem; padding: 3rem 2rem; text-align: center; background: #f7f9fc; }
.cms-cta--primary { background: var(--cz-theme-primary, #0575e2); color: #fff; }
.cms-cta--dark { background: #141824; color: rgba(255, 255, 255, .85); }
.cms-cta--primary .cms-cta__title, .cms-cta--dark .cms-cta__title { color: #fff; }
.cms-cta__title { font-size: 1.75rem; font-weight: 700; margin-bottom: .75rem; }
.cms-cta__text { font-size: 1.1rem; margin: 0 auto 1rem; max-width: 60ch; }
.cms-cta .cms-buttons { margin-top: 1rem; }

/* Cartões */
.cms-cards { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); margin: 1.5rem 0; }
@media (min-width: 768px) {
    .cms-cards--2, .cms-cards--3, .cms-cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
    .cms-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cms-cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.cms-card { border: 1px solid #eef0f2; border-radius: .75rem; overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, .04); }
.cms-card__img, .cms-content img.cms-card__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 0; border-radius: 0; }
.cms-card__icon { font-size: 2rem; color: var(--cz-theme-primary, #0575e2); padding: 1.5rem 1.25rem 0; }
.cms-card__title { font-size: 1.15rem; font-weight: 600; margin: 0 0 .5rem; }
.cms-card__link, .cms-content a.cms-card__link { font-weight: 600; text-decoration: none; color: var(--cz-theme-primary, #0575e2); }
.cms-content .cms-card p { font-size: 1rem; }

/* Perguntas frequentes */
.cms-faq__heading { margin-bottom: 1.5rem; }
.cms-faq__item { border: 1px solid #eef0f2; border-radius: .5rem; margin-bottom: .75rem; background: #fff; }
.cms-faq__question { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; list-style: none; position: relative; padding-right: 3rem; }
.cms-faq__question::-webkit-details-marker { display: none; }
.cms-faq__question::after { content: '+'; position: absolute; right: 1.25rem; top: 50%; transform: translateY(-50%); font-size: 1.25rem; color: var(--cz-theme-primary, #0575e2); }
.cms-faq__item[open] > .cms-faq__question::after { content: '–'; }
.cms-faq__answer { padding: 0 1.25rem 1rem; }
.cms-faq__answer > :last-child { margin-bottom: 0; }

/* Próximas ações */
.cms-formations__item { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 0; border-bottom: 1px solid #eef0f2; }
.cms-formations__date { flex: 0 0 3.5rem; text-align: center; border-radius: .5rem; background: #f7f9fc; padding: .35rem 0; }
.cms-formations__day { display: block; font-size: 1.35rem; font-weight: 700; line-height: 1.1; color: var(--cz-theme-primary, #0575e2); }
.cms-formations__month { display: block; font-size: .75rem; text-transform: uppercase; color: #6c757d; }
.cms-formations__body { flex: 1 1 auto; }
.cms-formations__course, .cms-content a.cms-formations__course { font-weight: 600; text-decoration: none; }

/* Blocos de catálogo dentro da coluna de leitura */
.cms-content .cms-catalogue a { text-decoration: none; }

/* Menu lateral da secção (layout SIDEBAR) */
.cms-sidebar-nav { position: sticky; top: 110px; border: 1px solid #eef0f2; border-radius: .75rem; padding: 1.25rem; background: #fff; }
.cms-sidebar-nav__title { font-weight: 700; margin-bottom: .75rem; }
.cms-sidebar-nav li a { display: block; padding: .35rem .5rem; border-radius: .35rem; color: #555; text-decoration: none; }
.cms-sidebar-nav li a:hover, .cms-sidebar-nav li a.active { background: #f7f9fc; color: var(--cz-theme-primary, #0575e2); }
.cms-sidebar-nav li a.active { font-weight: 600; }
