/* md-editorial-core blocks CSS
   ---------------------------------------
   Prefixo md- para isolamento.
   Variáveis do tema: var(--bg), var(--surface), etc.
*/

/* --- md/summary --- */
.md-summary {
    background: var(--surface-soft, #f7f8f9);
    border-left: 4px solid var(--accent, #c98a3a);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.md-summary__inner {
    max-width: 720px;
}

.md-summary__title {
    color: var(--heading, #0d2b4d);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.md-summary__content {
    color: var(--text, #20374b);
    line-height: 1.6;
    font-size: 15px;
}

/* --- md/toc --- */
.md-toc {
    border: 1px solid var(--border, #dfe6eb);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    background: var(--surface, #fff);
}

.md-toc__toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--heading, #0d2b4d);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
    padding: 8px 0;
}

.md-toc__list {
    counter-reset: toc;
    padding-left: 20px;
}

.md-toc__list,
.md-toc__item,
.md-toc__link {
    margin: 0;
    padding: 0;
    list-style: none;
}

.md-toc__item {
    position: relative;
    margin-bottom: 8px;
}

.md-toc__link {
    color: var(--muted, #718291);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 6px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.md-toc__link:hover {
    background: rgba(13, 43, 77, 0.04);
    color: var(--heading, #0d2b4d);
}

.md-toc__link:focus-visible {
    outline: 2px solid var(--accent, #c98a3a);
    outline-offset: 2px;
}

/* Headings levels */
.md-toc__list .md-toc__item--level-2 .md-toc__link {
    margin-left: 12px;
    font-weight: 600;
    color: var(--heading, #0d2b4d);
}

.md-toc__list .md-toc__item--level-3 .md-toc__link {
    margin-left: 24px;
    font-size: 13px;
    color: var(--muted, #718291);
}

/* --- md/legal-source --- */
.md-legal-source {
    border: 1px solid var(--border, #dfe6eb);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    background: var(--surface, #fff);
}

.md-legal-source__header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border, #dfe6eb);
}

.md-legal-source__title {
    color: var(--heading, #0d2b4d);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.md-legal-source__icon {
    margin-right: 8px;
    font-size: 20px;
    vertical-align: middle;
}

.md-legal-source__body {
}

.md-legal-source__field {
    margin-bottom: 12px;
}

.md-legal-source__field:last-child {
    margin-bottom: 0;
}

.md-legal-source__label {
    color: var(--muted, #718291);
    font-size: 13px;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.md-legal-source__value {
    color: var(--text, #20374b);
    font-size: 14px;
}

.md-legal-source__value a {
    color: var(--primary, #0d2b4d);
    text-decoration: underline;
}

.md-legal-source__footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border, #dfe6eb);
    font-size: 12px;
    color: var(--muted, #718291);
}

/* --- md/practical --- */
.md-practical {
    border: 1px solid var(--border, #dfe6eb);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    background: var(--surface, #fff);
}

.md-practical__icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.md-practical__content {
}

.md-practical__title {
    color: var(--heading, #0d2b4d);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.md-practical__body {
    color: var(--text, #20374b);
    line-height: 1.6;
    font-size: 15px;
}

/* --- md/alert --- */
.md-alert {
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.md-alert__icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

.md-alert--warning {
    border-left: 4px solid var(--warning, #9a6500);
    background: var(--warning-bg, #fff6dd);
    color: var(--warning, #9a6500);
}

.md-alert--danger {
    border-left: 4px solid var(--danger, #a93434);
    background: var(--danger-bg, #fff0f0);
    color: var(--danger, #a93434);
}

.md-alert--success {
    border-left: 4px solid var(--success, #347257);
    background: #e8f5e9;
    color: var(--success, #347257);
}

.md-alert__content {
    flex: 1;
    color: inherit;
    line-height: 1.5;
}

.md-alert__content p {
    margin: 0;
}

/* --- md/checklist --- */
.md-checklist {
    border: 1px solid var(--border, #dfe6eb);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    background: var(--surface, #fff);
}

.md-checklist__title {
    color: var(--heading, #0d2b4d);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px;
}

.md-checklist__list {
    padding-left: 0;
    margin: 0;
}

.md-checklist__item {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text, #20374b);
    font-size: 14px;
}

.md-checklist__item:last-child {
    margin-bottom: 0;
}

.md-checklist__checkbox {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary, #0d2b4d);
}

.md-checklist__label {
    cursor: pointer;
    user-select: none;
}

.md-checklist__checkbox:checked + .md-checklist__label {
    text-decoration: line-through;
    color: var(--muted, #718291);
}

/* --- md/example --- */
.md-example {
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
}

.md-example__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--accent, #c98a3a);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.md-example__content {
    color: var(--text, #20374b);
    line-height: 1.6;
    font-size: 14px;
}

/* --- md/faq --- */
.md-faq {
    margin: 24px 0;
}

.md-faq__title {
    color: var(--heading, #0d2b4d);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
}

.md-faq__accordion {
}

.md-faq__item {
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
}

.md-faq__question {
    width: 100%;
    text-align: left;
    background: var(--surface, #fff);
    border: none;
    padding: 16px 20px;
    color: var(--heading, #0d2b4d);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.md-faq__question:focus-visible {
    outline: 2px solid var(--accent, #c98a3a);
    outline-offset: 2px;
}

.md-faq__question-text {
    font-weight: 500;
}

.md-faq__question-icon {
    font-size: 14px;
    color: var(--muted, #718291);
    transition: transform 0.3s;
}

.md-faq__item.active .md-faq__question-icon {
    transform: rotate(90deg);
}

.md-faq__answer {
    padding: 0 20px 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    color: var(--muted, #718291);
    font-size: 13px;
    line-height: 1.5;
}

.md-faq__item.active .md-faq__answer {
    padding: 12px 20px 16px;
    max-height: 200px;
}

.md-faq__answer p {
    margin: 0;
}

/* --- md/references --- */
.md-references {
    margin: 24px 0;
}

.md-references__title {
    color: var(--heading, #0d2b4d);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
}

.md-references__list {
    padding-left: 0;
    margin: 0;
}

.md-references__item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border, #dfe6eb);
    list-style: none;
}

.md-references__item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.md-references__link {
    color: var(--primary, #0d2b4d);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.md-references__link:hover {
    text-decoration: underline;
}

.md-references__date {
    color: var(--muted, #718291);
    font-size: 12px;
    margin-left: 4px;
}

/* --- md/related --- */
.md-related {
    margin: 24px 0;
}

.md-related__title {
    color: var(--heading, #0d2b4d);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
}

.md-related__list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.md-related__item {
    margin-bottom: 16px;
}

.md-related__link {
    color: var(--text, #20374b);
    text-decoration: none;
    font-size: 14px;
    display: block;
}

.md-related__link:hover {
    color: var(--heading, #0d2b4d);
}

.md-related__title {
    font-weight: 600;
    margin-bottom: 4px;
}

.md-related__image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

/* --- md/portal-cta --- */
.md-portal-cta {
    border: 1px solid var(--border, #dfe6eb);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    background: var(--surface, #fff);
    text-align: center;
}

.md-portal-cta__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.md-portal-cta__content {
    text-align: center;
    margin-bottom: 20px;
}

.md-portal-cta__title {
    color: var(--heading, #0d2b4d);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
}

.md-portal-cta__description {
    color: var(--muted, #718291);
    font-size: 14px;
    margin: 0;
}

.md-portal-cta__action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.md-portal-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 24px;
    background: var(--accent, #c98a3a);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.md-portal-cta__button:hover {
    background: #b87e2f;
}

/* --- md/ad-slot --- */
.md-ad-slot {
    margin: 24px 0;
    min-height: 50px;
}

.md-ad-slot--article-inline {
    aspect-ratio: 1 / 1;
}

.md-ad-slot--article-inline-1,
.md-ad-slot--article-inline-2 {
    min-height: 50px;
}

.md-ad-slot--desktop-rail {
    min-height: 250px;
}

.md-ad-slot--related-content {
    min-height: 100px;
}

.md-ad-slot__placeholder {
    aspect-ratio: 1 / 1;
    background: var(--surface-soft, #f7f8f9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted, #718291);
    font-size: 12px;
    border: 1px dashed var(--border, #dfe6eb);
    border-radius: 8px;
}

/* --- Acessibilidade --- */
[aria-expanded] {
    transition: outline 0.2s;
}

*:focus-visible {
    outline: 2px solid var(--accent, #c98a3a);
    outline-offset: 2px;
}

/* --- prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    .md-toc__link,
    .md-faq__answer,
    .md-references__item,
    .md-faq__question-icon {
        transition: none;
    }
    .md-faq__item.active .md-faq__question-icon {
        transform: none;
    }
    .md-faq__item.active .md-faq__answer {
        max-height: 200px;
    }
}