/* ============================
   Design System — LabSiga CMS
   ============================ */
:root {
    /* Canonical public tokens from .specs/DESIGN.md. */
    --bg: #f5f5f7;
    --surface: #ffffff;
    --ink: #1d1d1f;
    --ink-secondary: #6e6e73;
    --hairline: rgba(0, 0, 0, 0.08);
    --fill-strong: #1d1d1f;
    --on-fill: #ffffff;
    --link: #1E3A6E;
    --link-hover: #152a52;
    --fill-subtle: rgba(0, 0, 0, 0.04);
    --danger: #b00020;

    /* Compatibility aliases derive from the canonical public tokens. */
    --primary: var(--ink);
    --primary-light: var(--link-hover);
    --primary-soft: var(--fill-subtle);
    --secondary: var(--link);
    --secondary-soft: var(--fill-subtle);
    --accent: var(--link);
    --accent-hover: var(--link-hover);
    --bg-gradient-top: var(--bg);
    --surface-muted: var(--bg);
    --text: var(--ink);
    --text-muted: var(--ink-secondary);
    --border: var(--hairline);
    --brand-emphasis: var(--ink);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.08);
    
    /* Radius & Spacing */
    --radius: 12px;
    --content-max: 1080px;
    /* Shared public chrome column — header + editorial + footer */
    --shell-max: 1280px;
    --shell-gutter: clamp(1rem, 3vw, 2rem);
    --reading-max: 760px;
    
    /* Editorial aliases use the same public chrome, not a separate theme. */
    --article-bg: var(--bg);
    --article-surface: var(--surface);
    --article-text: var(--ink);
    --article-muted: var(--ink-secondary);
    --article-border: var(--hairline);
    --article-reading-max: 760px;
    --child-card-width: 220px;
    --child-card-img-height: 120px;
    
    /* Navigation Configuration */
    --nav-hover-bg: var(--fill-subtle);
    --nav-active-bg: var(--fill-subtle);
    --nav-active-text: var(--ink);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    overflow-x: clip;
    background: var(--surface);
}

/* Sticky footer */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

h1, h2, h3, h4, h5, h6,
.editorial-section-title-main,
.editorial-section-title-accent,
.section-heading,
.article-title,
.child-card-title,
.section-card-title,
.brand-link--fallback::before,
.admin-page-title,
.admin-section-title,
.footer-brand {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

.content-wrapper {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    padding: 2.5rem 1rem 3rem;
    overflow-x: clip;
}

/* ============================
   Header & Navigation
   ============================ */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
    max-width: 100%;
    background: var(--surface);
    border-top: none;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    /* Same centered column as .editorial-section — .site-header bar stays full-bleed */
    width: min(var(--shell-max), calc(100vw - 2 * var(--shell-gutter)));
    max-width: 100%;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    background: var(--surface);
    box-sizing: border-box;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(0.35rem, 1.2vw, 1rem);
    padding: 0.85rem 0;
    min-height: 68px;
    flex-wrap: nowrap;
    position: relative;
    isolation: isolate;
}

.brand-link {
    display: block;
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    text-decoration: none;
    color: inherit;
    line-height: 0;
    background: var(--surface);
    /* Keep logo readable if nav ever overflows left */
    box-shadow: 0 0 0 8px var(--surface);
}

.brand-logo-slot {
    display: block;
    line-height: 0;
}

.brand-logo {
    display: block;
    height: clamp(46px, 4.2vw, 56px);
    width: auto;
    max-width: clamp(128px, 12vw, 170px);
    object-fit: contain;
    object-position: center left;
}

.brand-link--fallback::before {
    content: 'LabSiga';
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    padding: 0.25rem 0;
}

.header-nav-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(0.35rem, 0.8vw, 10px);
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    /* Free space between brand and auth — collapse nav when this is too narrow */
    container-type: inline-size;
    container-name: header-nav;
}

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-toggle:hover {
    background: var(--fill-subtle);
}

.nav-toggle[aria-expanded="true"] {
    background: var(--fill-subtle);
    border-color: color-mix(in srgb, var(--border) 70%, var(--ink) 30%);
}

.nav-toggle-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    position: relative;
    border-radius: 1px;
    transition: background 0.2s ease;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), top 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.header-admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    margin-left: clamp(0.35rem, 0.8vw, 0.75rem);
    padding-left: clamp(0.5rem, 1vw, 0.85rem);
    border-left: 1px solid var(--border);
    min-height: 40px;
    padding-right: 0;
    margin-right: -0.15rem;
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    font-size: clamp(0.72rem, 0.62rem + 0.28vw, 0.82rem);
    line-height: 1;
    letter-spacing: 0.01em;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    background: var(--surface);
}

.header-admin-link:hover {
    color: var(--primary-light);
    background: var(--primary-soft);
}

.header-admin-link:active {
    transform: scale(0.97);
}

.header-admin-link__icon {
    flex-shrink: 0;
    opacity: 0.88;
}

.header-auth {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    gap: 0.35rem;
    margin-left: clamp(0.35rem, 0.8vw, 0.75rem);
    padding: 0.2rem 0.2rem 0.2rem clamp(0.55rem, 1vw, 0.85rem);
    border-left: 1px solid var(--border);
    min-height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.header-auth__profile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.15rem 0.35rem 0.15rem 0;
}

.header-auth__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
}

.header-auth__name {
    color: var(--text);
    font-weight: 600;
    font-size: clamp(0.74rem, 0.64rem + 0.28vw, 0.84rem);
    line-height: 1.2;
    min-width: 0;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-auth__actions {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.15rem;
    padding-left: 0.15rem;
    border-left: 1px solid var(--border);
}

.header-auth__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.85rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: clamp(0.7rem, 0.62rem + 0.24vw, 0.78rem);
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease;
}

.header-auth__action:hover {
    color: var(--text);
    background: var(--primary-soft);
    text-decoration: none;
}

.header-auth__action--logout:hover {
    color: #be123c;
    background: rgba(253, 242, 248, 0.95);
}

.header-auth__username {
    color: var(--text);
    font-weight: 600;
    font-size: clamp(0.72rem, 0.62rem + 0.28vw, 0.82rem);
    line-height: 1;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-auth .header-admin-link {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    margin-right: 0;
}

.main-nav {
    flex: 1 1 auto;
    min-width: 0;
}

.main-nav > ul {
    list-style: none;
    display: flex;
    gap: clamp(0.2rem, 0.45vw, 0.45rem);
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end;
    padding: 0;
    margin: 0;
}

.main-nav > ul > li {
    flex: 0 0 auto;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: clamp(0.7rem, 0.6rem + 0.3vw, 0.86rem);
    line-height: 1.2;
    min-height: 40px;
    padding: 0.4rem clamp(0.3rem, 0.15rem + 0.35vw, 0.7rem);
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-nav a:hover {
    background: var(--nav-hover-bg);
    color: var(--primary);
}

.main-nav a:active {
    transform: scale(0.97);
}

.main-nav a.nav-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
}

.main-nav a.nav-active:hover {
    background: var(--nav-active-bg);
    color: var(--primary);
    filter: brightness(0.97);
}

/* Destaque — separado do menu principal por divisória */
.nav-highlight-wrapper {
    flex: 0 0 auto;
    margin-right: clamp(0.25rem, 0.6vw, 0.5rem);
    padding-right: clamp(0.35rem, 0.8vw, 0.65rem);
    border-right: 1px solid var(--border);
}

.nav-highlight {
    background: var(--fill-strong) !important;
    color: var(--surface) !important;
    padding: 0.4rem clamp(0.45rem, 0.3rem + 0.4vw, 0.85rem) !important;
    border-radius: 99px !important;
    font-weight: 700 !important;
    font-size: clamp(0.66rem, 0.56rem + 0.3vw, 0.82rem) !important;
    box-shadow: none !important;
    border: none !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-highlight:hover {
    background: #000000 !important;
    color: var(--surface) !important;
    transform: none;
}

.nav-highlight:active {
    transform: translateY(0) scale(0.97) !important;
}

.nav-highlight-active {
    background: var(--fill-strong) !important;
}

/* Dropdown — seções com Child Pages */
.nav-item-has-children {
    position: relative;
}

.nav-parent-row {
    display: flex;
    align-items: stretch;
}

.nav-parent-link {
    gap: 0.3rem;
}

.nav-chevron {
    font-size: 0.5rem;
    opacity: 0.55;
    line-height: 1;
    transition: transform 0.18s ease, opacity 0.18s;
}

.nav-branch-active > .nav-parent-row > .nav-parent-link:not(.nav-active) {
    color: var(--primary);
}

.nav-item-has-children:is(:hover, :focus-within) > .nav-parent-row > .nav-parent-link {
    background: var(--nav-hover-bg);
    color: var(--primary);
}

.nav-item-has-children:is(:hover, :focus-within) .nav-chevron {
    opacity: 0.9;
    transform: rotate(180deg);
}

.nav-submenu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.nav-submenu-toggle:hover {
    background: var(--nav-hover-bg);
    color: var(--primary);
}

.nav-dropdown {
    list-style: none;
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin: 0;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    z-index: 120;
}

.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 0;
    right: 0;
    height: 0.5rem;
}

.nav-dropdown a {
    display: flex;
    width: 100%;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    border-radius: 8px;
    min-height: 36px;
    padding: 0.45rem 0.75rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-dropdown a:hover {
    background: var(--nav-hover-bg);
    color: var(--primary);
}

.nav-dropdown a.nav-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
}

.nav-item-has-children:hover .nav-dropdown,
.nav-item-has-children:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ============================
   Content
   ============================ */
.content-container {
    width: min(100%, var(--content-max));
    margin: 0 auto;
    padding: 3rem clamp(1.25rem, 4vw, 4rem);
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-md);
    overflow-x: hidden;
    min-width: 0;
}

.content-container--home {
    padding-top: 2.75rem;
}

/* ============================
   Article
   ============================ */
.body--article {
    color: var(--article-text);
}

.body--editorial {
    background: var(--article-bg);
    color: var(--article-text);
}

html:has(body.body--editorial) {
    background: var(--article-bg);
}

.body--editorial .content-wrapper {
    padding-top: clamp(2.5rem, 4vw, 3.5rem);
    padding-bottom: 4rem;
}

.content-container--article {
    width: min(100%, var(--article-reading-max));
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 2rem) 2rem;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
}

.article-back {
    display: inline-block;
    margin-bottom: 1.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--article-muted);
    text-decoration: none;
    transition: color 0.18s;
}

.article-back:hover {
    color: var(--article-text);
}

.article-meta {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--article-muted);
}

.article-meta a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.18s;
}

.article-meta a:hover {
    color: var(--article-text);
}

.article-title {
    margin: 0 0 1.35rem;
    font-size: clamp(2rem, 4.8vw, 2.75rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--article-text);
}

.article-byline {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 2.5rem;
}

.article-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--fill-subtle);
    color: var(--ink);
    border: 1px solid var(--hairline);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: none;
    flex-shrink: 0;
}

.article-author {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--article-text);
}

.page-content--article {
    max-width: none;
    color: var(--article-text);
    font-size: 1.0625rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-break: normal;
}

.page-content--article > h1:first-child {
    display: none;
}

.page-content--article p,
.page-content--article div,
.page-content--article li,
.page-content--article h2,
.page-content--article h3,
.page-content--article blockquote {
    overflow-wrap: break-word;
    word-break: normal;
}

.page-content--article p {
    margin-bottom: 1.35rem;
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.page-content--article li {
    text-align: justify;
    text-align-last: left;
}

.page-content--article :is(h1, h2, h3, h4, figcaption, .article-meta, .article-byline) {
    text-align: left;
    text-align-last: auto;
}

.page-content--article h1 {
    color: var(--article-text);
    font-size: clamp(1.75rem, 2.4vw, 2.25rem);
    letter-spacing: -0.02em;
    margin: 2.25rem 0 0.85rem;
}

.page-content--article h2,
.page-content--article h3 {
    color: var(--article-text);
    letter-spacing: -0.015em;
}

.page-content--article h2 {
    font-size: clamp(1.4rem, 1.8vw, 1.6rem);
    margin-top: 2.5rem;
}

.page-content--article h3 {
    font-size: clamp(1.2rem, 1.4vw, 1.3rem);
}

.page-content--article a {
    color: var(--article-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.page-content--article a:hover {
    color: var(--primary);
}

.page-content--article blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-left: 4px solid var(--primary);
    background: var(--primary-soft);
    color: var(--text);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: 'Lora', Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.6;
    font-style: italic;
}

.page-content--article img {
    border-radius: 4px;
    box-shadow: none;
    margin: 1.5rem 0;
}

.page-content--article em {
    font-style: italic;
}

/* Image + text side-by-side (institutional pages) */
.content-media-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin: 1.5rem 0 2rem;
}

.content-media-row__media {
    flex: 0 0 min(42%, 240px);
    max-width: min(42%, 240px);
    margin: 0;
}

.content-media-row__media img {
    width: 100%;
    height: auto;
    margin: 0;
    display: block;
    border-radius: 4px;
    box-shadow: none;
}

.content-media-row__body {
    flex: 1;
    min-width: 0;
}

.content-media-row__body h2 {
    margin-top: 0;
}

.content-media-row__body p:last-child {
    margin-bottom: 0;
}

/* Editor image + text rows — canonical stateful layout */
.content-media-row--editor {
    flex-wrap: wrap;
    align-items: flex-start;
    max-width: 100%;
}

.content-media-row--editor.content-media-row--image-left {
    flex-direction: row;
}

.content-media-row--editor.content-media-row--image-right {
    flex-direction: row-reverse;
}

.content-media-row--editor.content-media-row--text-top {
    align-items: flex-start;
}

.content-media-row--editor.content-media-row--text-middle {
    align-items: center;
}

.content-media-row--editor.content-media-row--text-bottom {
    align-items: flex-end;
}

.content-media-row--editor.content-media-row--image-center {
    flex-direction: column;
    align-items: center;
}

.content-media-row--editor .content-media-row__media {
    flex: 0 1 auto;
    max-width: 100%;
}

.content-media-row--editor .content-media-row__body {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.content-media-row--editor.content-media-row--image-center .content-media-row__body {
    width: 100%;
    flex-basis: auto;
}

.page-content > figure:not(.media-embed):not(.content-media-row__media):not(.image-carousel):not(.linked-image) {
    margin: 1.25rem 0 2rem;
}

.page-content > figure:not(.media-embed):not(.content-media-row__media):not(.image-carousel):not(.linked-image) img {
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .content-media-row {
        flex-direction: column;
        gap: 1rem;
    }

    .content-media-row__media {
        flex-basis: auto;
        max-width: 200px;
    }

    .content-media-row--editor.content-media-row--image-left,
    .content-media-row--editor.content-media-row--image-right,
    .content-media-row--editor.content-media-row--image-center {
        flex-direction: column;
    }

    .content-media-row--editor {
        align-items: stretch;
    }

    .content-media-row--editor.content-media-row--image-center {
        align-items: center;
    }

    .content-media-row--editor .content-media-row__media {
        flex-basis: auto;
        max-width: 100%;
    }

    .content-media-row--editor .content-media-row__body {
        width: 100%;
        flex-basis: auto;
    }
}

/* Header & footer — harmonized with editorial surfaces */
.body--editorial .site-header {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--article-border);
    box-shadow: none;
}

.body--editorial .header-inner {
    background: transparent;
}

.body--editorial .header-top {
    min-height: 64px;
    padding: 0.65rem 0;
}

.body--editorial .main-nav a {
    color: var(--article-muted);
    font-weight: 500;
    font-size: clamp(0.68rem, 0.58rem + 0.38vw, 0.875rem);
    padding-inline: clamp(0.35rem, 0.2rem + 0.45vw, 0.85rem);
}

.body--editorial .main-nav a:hover {
    background: var(--fill-subtle);
    color: var(--article-text);
}

.body--editorial .main-nav a.nav-active,
.body--editorial .main-nav a.nav-active:hover {
    background: var(--fill-subtle);
    color: var(--article-text);
    filter: none;
}

.body--editorial .header-admin-link {
    color: var(--article-text);
    border-left-color: var(--article-border);
}

.body--editorial .header-admin-link:hover {
    color: var(--article-text);
    background: var(--fill-subtle);
}

.body--editorial .header-auth {
    background: var(--surface);
    border-left-color: var(--article-border);
    box-shadow: 0 1px 2px rgba(25, 23, 17, 0.04);
}

.body--editorial .header-auth__avatar {
    background: var(--fill-subtle);
    color: var(--article-text);
}

.body--editorial .header-auth__name {
    color: var(--article-text);
}

.body--editorial .header-auth__actions {
    border-left-color: var(--article-border);
}

.body--editorial .header-auth__action {
    color: var(--article-muted);
}

.body--editorial .header-auth__action:hover {
    color: var(--article-text);
    background: var(--fill-subtle);
}

.body--editorial .header-auth__action--logout:hover {
    color: #be123c;
    background: rgba(253, 242, 248, 0.95);
}

.body--editorial .nav-highlight-wrapper {
    border-right-color: var(--article-border);
}

.body--editorial .nav-highlight {
    background: transparent !important;
    color: var(--article-text) !important;
    border: 1px solid var(--article-border) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.body--editorial .nav-highlight:hover {
    background: var(--fill-subtle) !important;
    color: var(--article-text) !important;
}

.body--editorial .nav-highlight-active {
    background: var(--article-text) !important;
    color: var(--article-bg) !important;
    border-color: var(--article-text) !important;
}

.body--editorial .nav-branch-active > .nav-parent-row > .nav-parent-link:not(.nav-active) {
    color: var(--article-text);
}

.body--editorial .nav-item-has-children:is(:hover, :focus-within) > .nav-parent-row > .nav-parent-link {
    background: var(--fill-subtle);
    color: var(--article-text);
}

.body--editorial .nav-dropdown {
    background: var(--surface);
    border-color: var(--article-border);
    box-shadow: var(--shadow-md);
}

.body--editorial .nav-dropdown a {
    color: var(--article-text);
}

.body--editorial .nav-dropdown a:hover {
    background: var(--fill-subtle);
    color: var(--article-text);
}

.body--editorial .nav-dropdown a.nav-active {
    background: var(--fill-subtle);
    color: var(--article-text);
}

.body--editorial .nav-toggle {
    background: transparent;
    border-color: var(--article-border);
    color: var(--article-text);
    box-shadow: none;
}

.body--editorial .nav-toggle:hover {
    background: var(--fill-subtle);
}

.body--editorial .main-footer {
    margin-top: auto;
    background: var(--article-bg);
    border-top: 1px solid var(--article-border);
    color: var(--article-muted);
    padding: 2rem clamp(1rem, 4vw, 2rem) 2.25rem;
}

.body--editorial .footer-brand {
    color: var(--article-text);
    font-weight: 600;
}

.body--editorial .footer-copy,
.body--editorial .footer-address {
    color: var(--article-muted);
}

/* ============================
   Portal blog feed (cards)
   ============================ */
.portal-blog-feed {
    padding-top: 2.5rem;
    min-width: 0;
}

.portal-article-filters {
    display: grid;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
    max-width: 28rem;
}

.portal-article-filters > label {
    color: var(--ink);
    font-weight: 600;
}

.portal-article-filters input {
    min-height: 44px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    padding: 0.65rem 0.75rem;
}

.portal-blog-feed [hidden] {
    display: none !important;
}

.portal-article-filter-reset {
    margin-top: 0.75rem;
    min-height: 44px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    padding: 0.5rem 0.9rem;
    cursor: pointer;
}

.portal-post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.75rem, 3vw, 2.5rem) clamp(1.25rem, 2.5vw, 2rem);
    width: 100%;
    min-width: 0;
}

.portal-post-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.portal-post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.portal-post-card:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: var(--hairline);
    box-shadow: var(--shadow-md);
}

.portal-post-card:active {
    transform: translateY(-2px) scale(0.99);
}

.portal-post-card-media {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    background-color: var(--bg);
    background-size: cover;
    background-position: center;
    margin-bottom: 1rem;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-post-card:hover .portal-post-card-media {
    transform: scale(1.04);
    opacity: 0.95;
}

.portal-post-card-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.portal-post-card-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--article-muted);
}

.portal-post-card-date {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--article-muted);
    white-space: nowrap;
}

.portal-post-card-title {
    margin: 0 0 0.55rem;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--article-text);
}

.portal-post-card-excerpt {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--article-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.portal-post-card-author {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: auto;
}

.portal-post-card-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--fill-subtle);
    color: var(--ink);
    border: 1px solid var(--hairline);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: none;
}

.portal-post-card-author-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--article-text);
    line-height: 1.3;
}

.portal-blog-empty {
    padding: 3rem 0;
    color: var(--article-muted);
    font-size: 0.95rem;
}

/* ============================
   Editorial section pages (Sobre, etc.)
   ============================ */
.editorial-section {
    width: min(var(--shell-max), calc(100vw - 2 * var(--shell-gutter)));
    max-width: 100%;
    margin: 0 auto;
}

.editorial-section-layout {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
}

.editorial-section-sidebar {
    position: sticky;
    top: 5.5rem;
}

/* Align sidebar title with first body heading (h2 margin-top in article content) */
.editorial-section-sidebar .editorial-section-intro {
    padding-top: 2.5rem;
}

.editorial-section-title {
    margin: 0 0 0.85rem;
    line-height: 1.05;
    max-width: 100%;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

.editorial-section-title-main {
    display: block;
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--article-text);
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

.editorial-section-title-accent {
    display: block;
    margin-top: 0.1rem;
    font-family: 'Lora', Georgia, serif;
    font-size: 38px;
    font-weight: 500;
    font-style: italic;
    letter-spacing: -0.02em;
    color: var(--article-text);
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

.editorial-section-lead {
    margin: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--article-border);
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--article-muted);
}

.editorial-section-toc {
    margin-top: 1.5rem;
}

.editorial-section-toc-label {
    margin: 0 0 0.65rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--article-text);
}

.editorial-section-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.editorial-section-toc-link {
    display: block;
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--article-muted);
    text-decoration: none;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.editorial-section-toc-link:hover {
    background: var(--fill-subtle);
    color: var(--article-text);
}

.editorial-section-toc-link.is-active,
.editorial-section-toc-link.is-active:hover {
    background: var(--fill-subtle);
    color: var(--article-text);
    font-weight: 600;
}

.editorial-section-toc-item--level-2 .editorial-section-toc-link {
    padding-left: 0.65rem;
}

.editorial-section-toc-item--level-3 .editorial-section-toc-link {
    padding-left: 1.15rem;
    font-size: 0.82rem;
}

.editorial-section-body {
    min-width: 0;
    max-width: none;
    width: 100%;
}

/* Portal articles: two-column layout (sidebar | article), same grid as editorial pages */
.editorial-section-layout--article {
    align-items: start;
}

.editorial-section-sidebar--article {
    position: sticky;
    top: 5.5rem;
}

.editorial-section-article-main {
    min-width: 0;
}

.editorial-section--article .article-hero--with-sidebar .article-hero-title {
    margin: 0 0 1.35rem;
}

.editorial-section--article .article-hero--with-sidebar .article-hero-title .editorial-section-title-main,
.editorial-section--article .article-hero--with-sidebar .article-hero-title .editorial-section-title-accent {
    font-size: clamp(2rem, 4.8vw, 2.75rem);
}

.editorial-section--article .article-hero--with-sidebar .article-byline {
    margin-bottom: 2.5rem;
}

.editorial-section-article-body :is(h1, h2, h3) {
    scroll-margin-top: 5.75rem;
}

.editorial-section-body :is(h1, h2, h3) {
    scroll-margin-top: 5.75rem;
}

.body--editorial-section .content-wrapper {
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    margin: -0.5rem 0 1.5rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.18s;
}

.breadcrumb a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 600;
}

.breadcrumb-sep {
    opacity: 0.45;
    user-select: none;
}

.page-content {
    max-width: var(--reading-max);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Inside the editorial grid the body column is already bounded by the shell;
   fill that column so text/media are not a thin strip beside empty space. */
.editorial-section-layout .page-content,
.editorial-section-article-main .page-content {
    max-width: none;
    width: 100%;
}

.page-content p,
.page-content div,
.page-content li,
.page-content h1,
.page-content h2,
.page-content h3,
.page-content blockquote {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.page-content blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-left: 4px solid var(--primary);
    background: var(--primary-soft);
    color: var(--text);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: 'Lora', Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.6;
    font-style: italic;
}

.page-content--home {
    max-width: none;
}

.page-content--home h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    margin-bottom: 0.85rem;
}

.page-content--home > p:first-of-type {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 46ch;
    line-height: 1.65;
}

.section-heading {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.35rem;
    line-height: 1.25;
}

.section-lead {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    max-width: 52ch;
    line-height: 1.5;
}

.home-sections {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.section-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.section-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 120px;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-card:hover {
    transform: translateY(-4px) scale(1.015);
    border-color: var(--hairline);
    box-shadow: var(--shadow-md);
}

.section-card:active {
    transform: translateY(-2px) scale(0.985);
}

.section-card-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--secondary);
}

.section-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary);
    padding-right: 1.75rem;
}

.section-card-meta {
    margin-top: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.section-card-arrow {
    position: absolute;
    right: 0.85rem;
    bottom: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.95rem;
    transition: transform 0.18s, background 0.18s, color 0.18s;
}

.section-card:hover .section-card-arrow {
    background: var(--primary);
    color: white;
    transform: translateX(2px);
}

.page-content h1 {
    color: var(--primary);
    margin-bottom: 1.1rem;
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    line-height: 1.15;
    font-weight: 700;
}

.page-content h2,
.page-content h3 {
    color: var(--ink);
    line-height: 1.25;
    margin: 2rem 0 0.75rem;
}

.page-content h2 { font-size: 1.35rem; }
.page-content h3 { font-size: 1.1rem; }

.page-content p { margin-bottom: 1rem; }

.page-content ul,
.page-content ol {
    margin: 0 0 1.25rem 1.25rem;
}

.page-content li + li {
    margin-top: 0.35rem;
}

/* Images inside content — prevent overflow */
.page-content img,
.editor-area img {
    max-width: 100%;
    min-width: 0;
    height: auto;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    display: block;
}

.page-content figure,
.editor-area figure {
    min-width: 0;
    max-width: 100%;
}

.editor-area {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.editor-area p,
.editor-area div,
.editor-area li,
.editor-area blockquote {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

/* Figure captions — italic, smaller, centered */
.page-content figcaption,
.editor-area figcaption {
    font-style: italic;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.4rem;
    margin-bottom: 1rem;
}

/* ============================
   Child Page Cards (with thumbnail)
   ============================ */
.child-pages-grid {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}

.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.child-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.child-card:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: var(--hairline);
    box-shadow: var(--shadow-md);
}

.child-card:active {
    transform: translateY(-2px) scale(0.99);
}

.child-card-img {
    width: 100%;
    height: var(--child-card-img-height);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--surface-muted);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.child-card:hover .child-card-img {
    transform: scale(1.04);
}

.child-card-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    min-height: 3.25rem;
}

.child-card-text {
    flex: 1;
    min-width: 0;
}

.child-card-title {
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.child-card-author {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    line-height: 1.25;
    color: var(--ink-secondary);
}

.page-meta-author {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    color: var(--ink-secondary);
}

.child-card-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.child-card:hover .child-card-arrow {
    background: var(--primary);
    color: white;
    transform: translateX(3px) scale(1.05);
}

/* --- Editorial child page cards --- */
.editorial-child-pages {
    width: 100%;
    margin-top: clamp(2rem, 4vw, 3rem);
    padding-top: 1.75rem;
    border-top: 1px solid var(--article-border);
}

.editorial-child-pages .section-heading {
    color: var(--article-text);
}

.editorial-child-pages .section-lead {
    color: var(--article-muted);
}

.editorial-child-pages .cards-row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--child-card-width)), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
}

.editorial-child-page-card {
    min-width: 0;
}

.editorial-child-page-card:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .editorial-child-pages {
        margin-top: 2rem;
        padding-top: 1.25rem;
    }

    .editorial-child-pages .cards-row {
        gap: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .editorial-child-page-card,
    .editorial-child-page-card .child-card-img,
    .editorial-child-page-card .child-card-arrow {
        transition: none;
    }

    .editorial-child-page-card:hover {
        transform: none;
    }
}

/* ============================
   Image Toolbar (Editor)
   ============================ */
.img-toolbar {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    padding: 8px 10px;
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 200;
    flex-wrap: wrap;
}

.img-toolbar button {
    padding: 5px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    transition: background 0.15s;
}

.img-toolbar button:hover { background: var(--primary-soft); }

.img-toolbar input[type="number"] {
    width: 55px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
}

.img-toolbar label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ============================
   Footer
   ============================ */
.main-footer {
    padding: 1.25rem clamp(1rem, 4vw, 2rem);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    width: min(var(--shell-max), calc(100vw - 2 * var(--shell-gutter)));
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
}

.footer-brand {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.82rem;
}

.footer-copy {
    flex: 1 1 auto;
    text-align: center;
}

.footer-address {
    text-align: right;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[contenteditable="true"]:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
    outline-offset: 2px;
}

/* Desktop header — mild density only on very wide viewports */
@media (min-width: 1600px) and (max-width: 1800px) {
    .main-nav a {
        font-size: clamp(0.7rem, 0.6rem + 0.28vw, 0.84rem);
        padding: 0.4rem clamp(0.32rem, 0.18rem + 0.35vw, 0.72rem);
    }

    .nav-highlight {
        font-size: clamp(0.68rem, 0.58rem + 0.28vw, 0.82rem) !important;
        padding: 0.4rem clamp(0.45rem, 0.3rem + 0.4vw, 0.85rem) !important;
    }

    .header-auth__name {
        max-width: 9rem;
    }
}

/*
 * Collapse primary nav when the FREE slot between brand and auth is too narrow
 * for full labels (~highlight + 5 roots). Avoids flex-end overflow covering the logo.
 */
@container header-nav (max-width: 730px) {
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .main-nav {
        position: fixed;
        top: 4.5rem; /* JS ajusta com o botão ao abrir */
        right: max(0.75rem, var(--shell-gutter));
        left: auto;
        /* Nunca passa da metade da viewport (cresce só na metade direita) */
        width: min(18rem, 50vw);
        max-width: 50vw;
        flex: none;
        display: block;
        z-index: 130;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-0.4rem) scale(0.98);
        transform-origin: top right;
        transition:
            opacity 0.2s ease,
            transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
            visibility 0.24s;
    }

    .main-nav.nav-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .main-nav > ul {
        align-items: stretch;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-md);
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        overflow: hidden;
        max-height: min(70vh, 400px);
        overflow-y: auto;
    }

    .main-nav a {
        display: flex;
        align-items: center;
        min-height: 38px;
        padding: 0.45rem 0.75rem;
        border-radius: 0;
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        font-size: clamp(0.72rem, 2.6vw, 0.84rem);
    }

    .main-nav > ul > li { border-bottom: none; }
    .main-nav > ul > li:last-child a { border-bottom: none; }

    .nav-highlight-wrapper {
        order: 0;
        margin: 0;
        padding: 0.35rem 0.5rem 0.25rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .nav-highlight {
        justify-content: flex-start;
        border-radius: 4px !important;
        width: auto;
        border: none !important;
        min-height: 34px !important;
        padding: 0.35rem 0.65rem !important;
    }

    .nav-item-has-children .nav-parent-row {
        display: flex;
        align-items: stretch;
    }

    .nav-item-has-children .nav-parent-link {
        flex: 1;
        border-bottom: none;
        border-radius: 0;
    }

    .nav-submenu-toggle {
        display: inline-flex;
    }

    .nav-item-has-children .nav-chevron {
        display: none;
    }

    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        min-width: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        background: var(--surface-muted);
    }

    .nav-item-has-children.nav-submenu-open .nav-dropdown {
        display: block;
    }

    .nav-item-has-children.nav-submenu-open .nav-submenu-toggle {
        background: var(--primary-soft);
        color: var(--primary);
    }

    .nav-item-has-children.nav-submenu-open .nav-submenu-toggle span {
        transform: rotate(180deg);
        display: inline-block;
    }

    .body--editorial .main-nav > ul {
        background: var(--surface);
        border-color: var(--article-border);
        box-shadow: var(--shadow-md);
    }

    .body--editorial .main-nav a {
        border-bottom-color: var(--article-border);
        color: var(--article-text);
    }

    .body--editorial .nav-highlight-wrapper {
        border-bottom-color: var(--article-border);
    }

    .body--editorial .nav-dropdown {
        background: var(--bg);
    }

    .body--editorial .nav-dropdown a {
        border-bottom-color: var(--article-border);
    }

    .nav-dropdown a {
        padding-left: 1.25rem;
        font-size: 0.8rem;
        border-bottom: 1px solid var(--border);
        min-height: 34px;
    }

    .nav-dropdown li:last-child a {
        border-bottom: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .main-nav,
    .nav-toggle-icon,
    .nav-toggle-icon::before,
    .nav-toggle-icon::after {
        transition: none !important;
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 1535px) {
        .nav-toggle {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .main-nav {
            position: fixed;
            top: 4.5rem;
            right: max(0.75rem, var(--shell-gutter));
            left: auto;
            width: min(18rem, 50vw);
            max-width: 50vw;
            flex: none;
            display: block;
            z-index: 130;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transform: translateY(-0.4rem) scale(0.98);
            transform-origin: top right;
            transition:
                opacity 0.2s ease,
                transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.24s;
        }

        .main-nav.nav-open {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
            transform: translateY(0) scale(1);
        }

        .main-nav > ul {
            align-items: stretch;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: var(--shadow-md);
            flex-direction: column;
            gap: 0;
            max-height: min(70vh, 400px);
            overflow-y: auto;
        }

        .main-nav a {
            display: flex;
            white-space: nowrap;
            overflow: visible;
            text-overflow: clip;
            font-size: clamp(0.72rem, 2.6vw, 0.84rem);
        }
    }
}

/* Tiny phones: keep a little extra gutter inside the shell */
@media (max-width: 480px) {
    .header-inner,
    .footer-inner {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        box-sizing: border-box;
    }
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 768px) {
    .header-top {
        min-height: 60px;
        padding: 0.7rem 0;
    }

    .header-admin-link {
        margin-left: 0.35rem;
        padding-left: 0.5rem;
        min-width: 40px;
        padding-right: 0;
    }

    .header-admin-link__label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .header-auth__name {
        max-width: 5.5rem;
    }

    .header-auth__action {
        padding-inline: 0.5rem;
    }

    .brand-logo {
        height: 48px;
        max-width: 150px;
    }

    .content-container {
        width: 100%;
        margin: 0;
        padding: 1.5rem;
        border-radius: 8px;
    }

    .content-container--article {
        padding: 0 1.25rem 2rem;
    }

    .portal-blog-feed {
        padding-top: 0;
    }

    .editorial-section {
        width: 100%;
        max-width: 100%;
    }

    .editorial-section-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .editorial-section-layout--article {
        grid-template-columns: 1fr;
    }

    .editorial-section-sidebar--article {
        position: static;
    }

    .editorial-section-sidebar {
        position: static;
    }

    .portal-post-grid {
        grid-template-columns: 1fr;
    }

    .article-title {
        font-size: 1.85rem;
    }

    .editorial-section--article .article-hero--with-sidebar .article-hero-title .editorial-section-title-main,
    .editorial-section--article .article-hero--with-sidebar .article-hero-title .editorial-section-title-accent {
        font-size: 1.85rem;
    }

    .article-byline {
        margin-bottom: 2rem;
    }

    .cards-row {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }

    .section-cards-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-copy,
    .footer-address {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .content-wrapper { padding: 1rem 0.75rem 2rem; }

    .body--editorial .content-wrapper {
        padding-top: 2rem;
        padding-bottom: 3rem;
    }

    .brand-logo {
        height: 44px;
        max-width: 140px;
    }

    .page-content h1 { font-size: 1.55rem; }
    :root {
        --child-card-img-height: 96px;
    }

    .cards-row {
        grid-template-columns: 1fr;
    }
}

/* Embedded video and maps */
.media-embed {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 2rem 0;
    overflow: hidden;
    color: var(--ink);
}

.media-embed__frame,
.media-embed__map-frame {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--bg);
}

.media-embed__frame {
    aspect-ratio: 16 / 9;
}

.media-embed__map-frame {
    height: clamp(18rem, 52vw, 28rem);
}

.media-embed iframe {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    border: 0;
}

.media-embed__fallback {
    margin: 0.65rem 0 0;
    color: var(--ink-secondary);
    font-size: 0.9rem;
}

.media-embed__fallback a {
    color: var(--link);
    text-underline-offset: 0.18em;
}

.media-embed__fallback a:hover {
    color: var(--link-hover);
}

.media-embed__fallback a:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Image carousel (editorial galleries) */
.image-carousel {
    position: relative;
    width: 75%;
    max-width: 100%;
    min-width: 0;
    margin: 2rem auto;
    color: var(--ink);
}

.image-carousel__viewport {
    overflow: hidden;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--surface);
}

.image-carousel__track {
    list-style: none;
    margin: 0;
    padding: 0;
}

.image-carousel__slide {
    display: none;
    margin: 0;
}

.image-carousel__slide.is-active {
    display: block;
}

.image-carousel__slide img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.image-carousel__caption {
    margin: 0;
    padding: 0.75rem 1rem 1rem;
    color: var(--ink-secondary);
    font-size: 0.95rem;
    line-height: 1.45;
    background: var(--surface);
}

.image-carousel__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    color: var(--ink);
    cursor: pointer;
}

.image-carousel__nav::before {
    content: '';
    display: block;
    width: 0.55rem;
    height: 0.55rem;
    margin: 0 auto;
    border-top: 2px solid var(--ink);
    border-right: 2px solid var(--ink);
}

.image-carousel__nav--prev {
    left: 0.75rem;
}

.image-carousel__nav--prev::before {
    transform: translateX(0.12rem) rotate(-135deg);
}

.image-carousel__nav--next {
    right: 0.75rem;
}

.image-carousel__nav--next::before {
    transform: translateX(-0.12rem) rotate(45deg);
}

.image-carousel__nav:hover {
    background: var(--surface);
    border-color: var(--link);
}

.image-carousel__nav:focus-visible,
.image-carousel__dot:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

.image-carousel__dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.image-carousel__dot {
    width: 0.55rem;
    height: 0.55rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--fill-subtle);
    cursor: pointer;
}

.image-carousel__dot.is-active {
    background: var(--fill-strong);
}

.image-carousel__slide,
.image-carousel__caption {
    transition: opacity 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
    .image-carousel__slide,
    .image-carousel__caption,
    .image-carousel__nav {
        transition: none;
    }
}

/* ============================
   Scroll Reveal Animation (Apple-style)
   Only hide while animating when JS is available (html.js). Without JS, content stays visible.
   ============================ */
html.js .reveal-section {
    opacity: 0;
    transform: translateY(48px);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

html.js .reveal-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    html.js .reveal-section {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ============================
   Migrated archives and team
   ============================ */
.reading-column {
    width: 100%;
    max-width: 760px;
    min-width: 0;
    overflow-x: clip;
}

.team-section,
.team-profile,
.event-archive {
    max-width: 100%;
    overflow: hidden;
}

.team-section__header,
.event-archive > .reading-column,
.event-archive header {
    margin-bottom: 2rem;
}

.page-content > .linked-image,
.admin-editor-area > .linked-image,
.admin-editor-area .linked-image,
.admin-rich-editor__surface > .linked-image,
.admin-rich-editor__surface .linked-image,
.event-detail-description > .linked-image {
    display: inline-block;
    vertical-align: top;
    box-sizing: border-box;
    width: 50%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
}

.linked-image > a,
.linked-image__link {
    display: block;
    color: var(--link);
    border-radius: 8px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    transition: opacity 0.18s ease;
}

.linked-image > a:hover,
.linked-image__link:hover {
    opacity: 0.88;
}

.linked-image > a:focus-visible,
.linked-image__link:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

.linked-image img,
.linked-image > a img,
.linked-image__link img,
.page-content--article .linked-image__link img,
.page-content .linked-image__link img,
.editor-area .linked-image__link img,
.admin-editor-area .linked-image__link img,
.admin-rich-editor__surface .linked-image__link img,
.event-detail-description .linked-image__link img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
}

.page-content .linked-image__caption,
.admin-editor-area .linked-image__caption,
.editor-area .linked-image__caption,
.admin-rich-editor__surface .linked-image__caption,
.event-detail-description .linked-image__caption {
    margin-top: 0.75rem;
    margin-bottom: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--hairline);
    color: var(--ink);
    font-size: 0.9375rem;
    font-style: normal;
    text-align: left;
}

.linked-image__caption-link {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 0.16em;
}

@media (max-width: 767px) {
    .page-content > .linked-image,
    .admin-editor-area > .linked-image,
    .admin-editor-area .linked-image,
    .admin-rich-editor__surface > .linked-image,
    .admin-rich-editor__surface .linked-image,
    .event-detail-description > .linked-image {
        display: block;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.team-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
}

.team-card {
    display: grid;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
    max-width: 100%;
    padding: 1rem;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.team-card__photo,
.team-profile__photo {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}

.team-card__name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1.25;
}

.team-card:hover {
    border-color: var(--ink-secondary);
    transform: translateY(-2px);
}

.team-profile__layout {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(1.5rem, 4vw, 3rem);
}

.event-archive-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.75rem, 3vw, 2.75rem);
    width: 100%;
    min-width: 0;
}

.event-archive-card,
.event-archive-edition {
    display: grid;
    gap: 0.75rem;
    color: var(--ink);
    text-decoration: none;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--surface);
    padding: 1rem;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.event-archive-card img {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 8px;
}

.event-archive-editions {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.event-archive-edition span {
    color: var(--ink-secondary);
    font-size: 0.875rem;
}

.event-archive-card:hover,
.event-archive-edition:hover {
    border-color: var(--ink-secondary);
    transform: translateY(-2px);
}

.event-archive-status {
    margin: 1rem 0;
    color: var(--ink-secondary);
    font-size: 0.9375rem;
}


.event-edition-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem 1.25rem;
    margin: 1.5rem 0;
}

.event-edition-actions__files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 1 1 16rem;
}

.event-edition-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.375rem;
    border-radius: 980px;
    background: var(--fill-strong);
    color: var(--on-fill);
    text-decoration: none;
    font-weight: 600;
}

.event-edition-actions a:hover {
    background: #000000;
}

.event-edition-actions a:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

.event-edition-actions__register {
    margin-left: auto;
    flex: 0 0 auto;
    align-self: flex-start;
    background: var(--link);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 25%, transparent);
}

.event-edition-actions__register:hover {
    background: var(--link-hover);
}

.portal-post-card-cta {
    display: inline-block;
    margin-top: auto;
    color: var(--link);
    font-weight: 600;
}

.portal-post-card-status {
    margin: 0;
    margin-top: auto;
    color: var(--ink-secondary);
    font-size: 0.9375rem;
}

.portal-post-card--indisponivel {
    cursor: default;
}

.team-card:focus-visible,
.event-archive-card:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

.event-archive-edition:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

body.admin-body--reading-preview .admin-thumb-dropzone:not(.admin-thumb-dropzone--portal) {
    width: min(100%, 18rem);
    min-height: 0;
    aspect-ratio: 1;
    border-radius: 50%;
}

body.admin-body--reading-preview .admin-thumb-dropzone:not(.admin-thumb-dropzone--portal) .admin-thumb-preview {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 640px) {
    .team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .team-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .team-profile__layout,
    .event-archive-grid {
        grid-template-columns: 1fr;
    }

    .event-edition-actions {
        flex-direction: column;
    }

    .event-edition-actions a {
        width: 100%;
    }

    .event-edition-actions__files {
        flex: 1 1 auto;
        flex-direction: column;
        width: 100%;
    }

    .event-edition-actions__register {
        margin-left: 0;
        order: -1;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .team-card,
    .event-archive-card {
        transition: none;
    }

    .linked-image > a,
    .linked-image__link {
        transition: none;
    }

    .event-archive-edition {
        transition: none;
    }
}
