/*
 * Estilos do popup exibido no front-end.
 *
 * Organização:
 * 1) variáveis visuais
 * 2) container/modal
 * 3) conteúdo interno
 * 4) trigger no texto
 */

:root {
    --st-popup-bg: #ffffff;
    --st-popup-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    --st-popup-radius: 8px;
    --st-popup-z-index: 999999;
    --st-popup-width: 400px;
    --st-popup-min-width: 260px;
    --st-popup-max-width: 92vw;
    --st-popup-max-height: 88vh;
    --st-popup-padding: 20px;
    --st-popup-close-size: 32px;

    --st-close-color: #444444;
    --st-close-color-hover: #d63638;

    --st-trigger-color: #0073aa;
    --st-trigger-bg: #eaf5fb;
    --st-trigger-color-hover: #ffffff;
    --st-trigger-bg-hover: #005177;
}

.wp-mapa-embed {
    width: 100%;
    max-width: 100%;
    position: relative;
    margin: 1em 0;
}

.wp-mapa-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

#st-frontend-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: var(--st-popup-z-index);
    display: inline-block;
    width: auto;
    min-width: min(var(--st-popup-min-width), 90vw);
    max-width: min(var(--st-popup-max-width), 100%);
    max-height: var(--st-popup-max-height);
    padding: var(--st-popup-padding);
    border: var(--st-popup-border-width) solid var(--st-popup-border-color);
    border-radius: var(--st-popup-radius);
    background: var(--st-popup-bg);
    box-shadow: var(--st-popup-shadow);
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    overflow: hidden;
}

.st-popup-content {
    position: relative;
    max-width: 100%;
    max-height: calc(var(--st-popup-max-height) - (var(--st-popup-padding) * 2));
    overflow: hidden;
    overscroll-behavior: contain;
}

.st-popup-body {
    max-width: 100%;
    max-height: calc(var(--st-popup-max-height) - (var(--st-popup-padding) * 2));
    padding-right: calc(var(--st-popup-close-size) + 8px);
    overflow: auto;
}

.st-popup-body > * {
    max-width: 100%;
}

.st-popup-body table,
.st-popup-body pre,
.st-popup-body code {
    max-width: 100%;
}

.st-popup-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    width: var(--st-popup-close-size);
    height: var(--st-popup-close-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    color: var(--st-close-color);
    background: var(--st-popup-bg);
    border-radius: 6px;
}

.st-popup-close:hover,
.st-popup-close:focus {
    color: var(--st-close-color-hover);
}

.st-popup-trigger {
    cursor: help;
    color: var(--st-trigger-color);
    text-decoration: none;
    background: var(--st-trigger-bg);
    border-radius: 3px;
    padding: 0 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.st-popup-trigger:hover,
.st-popup-trigger:focus {
    color: var(--st-trigger-color-hover);
    background: var(--st-trigger-bg-hover);
}

/* Compatibilidade de alinhamento de imagens/classes nativas do WordPress. */
.single-super_texto .st-supertexto-entry__content img.alignleft,
.single-super_texto .st-supertexto-entry__content .alignleft,
.st-popup-body img.alignleft,
.st-popup-body .alignleft {
    float: left;
    margin: 0 1.5em 1em 0;
}

.single-super_texto .st-supertexto-entry__content img.alignright,
.single-super_texto .st-supertexto-entry__content .alignright,
.st-popup-body img.alignright,
.st-popup-body .alignright {
    float: right;
    margin: 0 0 1em 1.5em;
}

.single-super_texto .st-supertexto-entry__content img.aligncenter,
.single-super_texto .st-supertexto-entry__content .aligncenter,
.st-popup-body img.aligncenter,
.st-popup-body .aligncenter {
    float: none;
    display: block;
    margin: 0 auto 1em;
}

.single-super_texto .st-supertexto-entry__content .wp-caption.alignleft,
.st-popup-body .wp-caption.alignleft {
    float: left;
    margin: 0 1.5em 1em 0;
}

.single-super_texto .st-supertexto-entry__content .wp-caption.alignright,
.st-popup-body .wp-caption.alignright {
    float: right;
    margin: 0 0 1em 1.5em;
}

.single-super_texto .st-supertexto-entry__content .wp-caption.aligncenter,
.st-popup-body .wp-caption.aligncenter {
    float: none;
    margin: 0 auto 1em;
}

/*
 * Layout e navegacao de livros/capitulos (CPT hierarquico).
 */

.st-book-layout {
    display: block;
}

.st-book-layout__sidebar {
    position: static;
    margin-bottom: 24px;
}

.st-book-sidebar {
    padding: 16px;
    border: 1px solid #e0e4ea;
    border-radius: 10px;
    background: #f8fafc;
}

.st-book-sidebar__title {
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1d2327;
}

.st-book-tree,
.st-book-tree__children {
    margin: 0;
    padding-left: 16px;
    list-style: none;
}

.st-book-tree {
    padding-left: 0;
}

.st-book-tree__item {
    margin: 6px 0;
}

.st-book-tree__link {
    color: #1d2327;
    text-decoration: none;
}

.st-book-tree__item.current > .st-book-tree__link,
.st-book-tree__item.current_page_item > .st-book-tree__link,
.st-book-tree__item.active > .st-book-tree__link {
    font-weight: 700;
    color: #0a4b78;
}

.st-book-tree__item.current_ancestor > .st-book-tree__link {
    color: #0a4b78;
}

.st-book-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0;
    padding: 10px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.st-book-nav .nav-previous,
.st-book-nav .nav-next {
    flex: 1;
}

.st-book-nav .nav-next {
    text-align: right;
}

.st-book-nav a {
    color: #0a4b78;
    text-decoration: none;
    font-weight: 600;
}

.st-book-nav a:hover,
.st-book-nav a:focus {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .st-book-nav {
        flex-direction: column;
        gap: 8px;
    }

    .st-book-nav .nav-next {
        text-align: left;
    }
}

/*
 * Metadados de autor/data: mantem apenas o autor em singles do CPT.
 * Cobertura para seletores comuns de temas.
 */
.single-super_texto .posted-on,
.single-super_texto .entry-date,
.single-super_texto time.entry-date,
.single-super_texto .meta-date,
.single-super_texto .post-date,
.single-super_texto .byline .date,
.single-super_texto .entry-meta .date {
    display: none !important;
}

/*
 * Wrapper do template proprio do CPT.
 * O objetivo e centralizar o conteudo sem competir com estilos do tema.
 */
.single-super_texto .st-supertexto-template {
    width: min(100%, 1100px);
    margin: 0 auto;
    padding: 14px;
    border: 1px solid #d8dee4;
    border-radius: 8px;
    box-sizing: border-box;
}

.single-super_texto .st-supertexto-entry__header {
    margin-bottom: 1.25rem;
}

.single-super_texto .st-header-fields {
    margin-top: 8px;
    text-align: center;
    font-size: 0.98rem;
    color: #475569;
}

.single-super_texto .st-header-fields__item {
    display: inline;
}

.single-super_texto .st-header-fields__item + .st-header-fields__item::before {
    content: ' | ';
    color: #94a3b8;
}

.single-super_texto .st-header-fields__label {
    font-weight: 600;
}

.single-super_texto .st-post-metadata {
    margin-top: 12px;
    margin-left: auto;
    margin-right: auto;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 0.9rem;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
}

.single-super_texto .st-post-metadata__list {
    margin: 0;
    padding: 0;
    display: grid;
    row-gap: 8px;
}

.single-super_texto .st-post-metadata__row {
    display: grid;
    grid-template-columns: minmax(120px, max-content) minmax(0, max-content);
    gap: 12px;
    align-items: center;
}

.single-super_texto .st-post-metadata__field {
    margin: 0;
    padding: 0;
    font-weight: 600;
    font-size: 0.86rem;
    line-height: 1.4;
}

.single-super_texto .st-post-metadata__value {
    margin: 0;
    padding: 0;
    margin-left: 0;
    font-size: 0.86rem;
    line-height: 1.4;
}

.single-super_texto .st-post-metadata__value::before {
    content: none !important;
    display: none !important;
}

@media (max-width: 768px) {
    .single-super_texto .st-supertexto-template {
        padding: 12px;
        border-width: 1px;
    }

    .single-super_texto .st-header-fields__item {
        display: block;
    }

    .single-super_texto .st-header-fields__item + .st-header-fields__item::before {
        content: '';
    }

    .single-super_texto .st-post-metadata__row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .single-super_texto .st-post-metadata {
        display: block;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 10px 12px;
    }
}