/* ==========================================================================
   AliErMan - Folha de estilos principal
   Reescrita para deixar de competir com interativo.css. Aqui fica a
   estrutura do sitio: barra de topo, menu, corpo, barra lateral e rodape.
   As cores vem todas de tema.css.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--fundo);
    color: var(--texto);
    font-size: 14px;
    line-height: 1.55;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--fundo-brilho);
    z-index: -1;
    pointer-events: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Barra de topo ---------------------------------------------------------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: var(--barra);
    color: var(--barra-texto);
    padding: 8px 5%;
    box-shadow: 0 4px 20px var(--sombra-2);
    position: sticky;
    top: 0;
    /* Atencao a este numero. O cabecalho e um elemento posicionado com
       z-index, portanto abre um contexto de empilhamento proprio, e o
       z-index do nav la dentro so vale dentro do cabecalho. E por isso que
       o veu do menu tambem e colocado aqui dentro, pelo menu.js: se fosse
       filho do body, passava a frente do painel e os toques no menu iam
       todos parar ao veu em vez dos links. */
    z-index: 999;
}

.logo-container {
    min-width: 0;
    flex: 1 1 auto;
}

.site-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.site-subtitle {
    font-size: 12px;
    margin: 2px 0 0;
    line-height: 1.3;
    opacity: 0.88;
}

.accoes-topo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

#openMenu,
#closeMenu {
    font-size: 18px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.25s ease;
}

#openMenu:hover,
#closeMenu:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Navegacao -------------------------------------------------------------- */
nav {
    display: flex;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

nav ul li {
    position: relative;
}

nav ul li a {
    text-decoration: none;
    color: #ffffff;
    padding: 8px 12px;
    display: block;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.25s ease;
    font-size: 13px;
}

nav ul li a:hover,
nav ul li a:focus-visible {
    background-color: rgba(255, 255, 255, 0.16);
}

/* Submenus. Fecham e abrem por classe, nunca por estilo em linha, para que
   o rato no computador e o toque no telefone nao se atrapalhem um ao outro. */
nav ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(67, 56, 202, 0.97);
    backdrop-filter: blur(10px);
    padding: 8px 0;
    margin: 0;
    width: max-content;
    max-width: 78vw;
    border-radius: var(--raio-curto);
    box-shadow: 0 10px 25px var(--sombra-3);
    z-index: 1000;
    list-style: none;
}

nav ul li.submenu-aberto > ul {
    display: block;
}

nav ul li ul li a {
    padding: 8px 18px;
    border-radius: 0;
    white-space: normal;
}

.arrow {
    margin-left: 6px;
    display: inline-block;
    font-size: 10px;
    transition: transform 0.25s ease;
    pointer-events: none;
}

nav ul li.submenu-aberto > a .arrow {
    transform: rotate(180deg);
}

/* Abertura por rato so em ecra grande e em aparelhos que tenham mesmo rato. */
@media (hover: hover) and (min-width: 769px) {
    nav ul li:hover > ul {
        display: block;
    }

    nav ul li:hover > a .arrow {
        transform: rotate(180deg);
    }
}

/* Corpo ------------------------------------------------------------------ */
.main-content {
    display: flex;
    flex: 1;
    margin: 20px 5%;
    gap: 20px;
    align-items: flex-start;
}

main {
    flex: 3;
    min-width: 0;
    padding: 30px;
    background: var(--superficie);
    border-radius: var(--raio);
    box-shadow: 0 8px 32px var(--sombra-2);
    backdrop-filter: var(--desfoque);
    border: 1px solid var(--linha);
}

.full-height {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

/* Barra lateral ---------------------------------------------------------- */
aside {
    flex: 1;
    min-width: 0;
    padding: 25px;
    background: var(--superficie);
    border-radius: var(--raio);
    box-shadow: 0 8px 32px var(--sombra-2);
    backdrop-filter: var(--desfoque);
    border: 1px solid var(--linha);
    text-align: justify;
    color: var(--texto);
}

aside aside {
    padding: 20px;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.85), rgba(16, 185, 129, 0.8));
    color: #ffffff;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--linha);
    box-shadow: 0 4px 15px var(--sombra-1);
    backdrop-filter: none;
}

/* Os paineis coloridos da barra lateral mantem o gradiente nos dois modos,
   porque sao a assinatura visual do sitio. Sendo assim, o texto que assenta
   neles tem de ser sempre claro: se seguisse a cor do tema, ficava cinzento
   escuro sobre azul e verde no modo dia, praticamente ilegivel. */
aside aside,
aside aside p,
aside aside .header,
aside aside .expandable-list li a {
    color: #ffffff;
}

aside aside .header {
    background: rgba(255, 255, 255, 0.16);
}

aside aside .header:hover {
    background: rgba(255, 255, 255, 0.26);
}

aside aside .expandable-list li a {
    background: rgba(255, 255, 255, 0.12);
}

aside aside .expandable-list li a:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* Rodape ----------------------------------------------------------------- */
footer {
    background: var(--barra);
    color: #ffffff;
    text-align: center;
    width: 100%;
    padding: 10px 15px;
    margin-top: 24px;
    box-shadow: 0 -4px 20px var(--sombra-2);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 20px;
}

footer p {
    margin: 2px 0;
    line-height: 1.4;
    font-size: 11px;
}

footer a {
    color: #cffafe;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    transition: transform 0.25s ease, background 0.25s ease;
}

.social-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Blocos de conteudo ----------------------------------------------------- */
.sec,
.seca {
    background: rgba(99, 102, 241, 0.16);
    color: var(--texto);
    padding: 20px 25px;
    border-radius: 12px;
    text-align: justify;
    margin-bottom: 24px;
    border: 1px solid var(--linha);
    box-shadow: 0 4px 15px var(--sombra-1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sec:hover,
.seca:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--sombra-2);
}

.degr,
.degra {
    background: linear-gradient(90deg, #6366f1, #10b981);
    padding: 12px 20px;
    border-radius: 30px;
    text-align: center;
    color: #ffffff;
    font-weight: 600;
    margin: 20px 0;
    box-shadow: 0 4px 15px var(--sombra-1);
}

.degra {
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    text-align: right;
}

/* Caixas de dialogo ------------------------------------------------------ */
#senha-form,
#erro-acesso,
.modal-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--superficie-solida);
    padding: 25px;
    border-radius: var(--raio);
    box-shadow: 0 10px 30px var(--sombra-3);
    z-index: 2000;
    border: 1px solid var(--linha);
    color: var(--texto);
    max-width: 400px;
    width: calc(100% - 32px);
}

#senha-form h3,
#erro-acesso h3 {
    font-size: 16px;
    color: var(--realce);
    margin: 8px 0 10px;
}

#senha-form p,
#erro-acesso p {
    color: var(--texto-suave);
    font-size: 13px;
}

#senha-form input[type="password"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid var(--linha-forte);
    border-radius: 8px;
    background: var(--linha-tenue);
    color: var(--texto);
    font-size: 14px;
}

#senha-form input[type="password"]:focus {
    outline: none;
    border-color: var(--marca-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

#senha-form input.error {
    border-color: var(--erro);
}

#senha-form button[type="submit"],
#erro-acesso button,
.btn-primary,
.btn-secondary {
    background: linear-gradient(90deg, #6366f1, #3b82f6);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    width: 100%;
    margin-top: 10px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#senha-form button[type="submit"]:hover,
#erro-acesso button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.45);
}

#senha-form button.success {
    background: linear-gradient(90deg, #059669, #10b981);
}

#senha-form button.error {
    background: linear-gradient(90deg, #b91c1c, #ef4444);
}

#erro-acesso .btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#erro-acesso .btn-secondary a {
    color: #ffffff;
    text-decoration: none;
}

.error-icon {
    font-size: 30px;
    color: #f59e0b;
    text-align: center;
}

.close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--texto);
    font-size: 20px;
    cursor: pointer;
    width: auto;
    margin: 0;
    padding: 4px 8px;
}

.close:hover {
    color: var(--erro);
}

@keyframes tremor {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(calc(-50% - 8px), -50%); }
    75% { transform: translate(calc(-50% + 8px), -50%); }
}

.shake {
    animation: tremor 0.4s ease;
}

/* Versiculo biblico ------------------------------------------------------ */
#verse {
    font-size: 1rem;
    color: #ffffff;
    text-align: justify;
    font-style: italic;
    line-height: 1.6;
    margin: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Listas expansiveis da barra lateral ------------------------------------ */
.expandable-list {
    display: none;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.expandable-list li {
    margin: 6px 0;
}

.expandable-list li a {
    display: block;
    padding: 10px 14px;
    color: var(--texto);
    text-decoration: none;
    border-radius: 8px;
    background: var(--linha-tenue);
    transition: background 0.25s ease, transform 0.25s ease;
}

.expandable-list li a:hover {
    background: var(--linha);
    transform: translateX(4px);
}

.header {
    cursor: pointer;
    padding: 12px 15px;
    margin: 10px 0;
    background: rgba(99, 102, 241, 0.18);
    border-radius: var(--raio-curto);
    font-weight: 600;
    color: var(--texto);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    transition: background 0.25s ease;
}

.header:hover {
    background: rgba(99, 102, 241, 0.3);
}

.header::after {
    content: "\25BC";
    font-size: 0.7em;
    transition: transform 0.3s ease;
}

.header.open::after {
    transform: rotate(180deg);
}

/* ==========================================================================
   Adaptacao a ecras pequenos. O painel do menu desliza a partir da direita
   e nunca muda de display, o que evita o menu desaparecer ao rodar o ecra.
   ========================================================================== */
@media (max-width: 768px) {
    header {
        padding: 8px 14px;
    }

    #openMenu {
        display: inline-flex;
    }

    #closeMenu {
        display: inline-flex;
        position: absolute;
        top: 14px;
        right: 14px;
    }

    nav {
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        height: 100dvh;
        width: 84%;
        max-width: 320px;
        background: rgba(49, 46, 129, 0.98);
        backdrop-filter: blur(10px);
        padding: 62px 14px 24px;
        z-index: 1001;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        transition: transform 0.3s ease, visibility 0.3s ease;
        visibility: hidden;
        box-shadow: -8px 0 30px var(--sombra-3);
    }

    nav.show {
        transform: translateX(0);
        visibility: visible;
    }

    nav ul {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    nav ul li {
        width: 100%;
    }

    nav ul li a {
        padding: 12px 14px;
        font-size: 14px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    nav ul li > a.has-submenu {
        justify-content: space-between;
    }

    nav ul li > a.has-submenu .arrow {
        margin-left: auto;
    }

    /* No telefone o submenu passa a fazer parte da lista, sem posicao
       absoluta, sem transparencia estranha e sem depender do rato. */
    nav ul li ul {
        position: static;
        width: 100%;
        max-width: none;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: none;
        margin: 4px 0 8px;
        border-radius: 8px;
        box-shadow: none;
    }

    nav ul li ul li a {
        padding: 10px 12px 10px 28px;
        font-size: 13px;
    }

    /* Fica entre a pagina (0) e o cabecalho (1002), nunca acima do menu. */
    .veu-menu {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .veu-menu.visivel {
        opacity: 1;
    }

    .main-content {
        flex-direction: column;
        margin: 14px 4%;
    }

    /* No telefone o conteudo da pagina vem primeiro e a barra lateral fica
       por baixo, tal como sempre esteve. Empurrar a barra para cima obrigava
       a rolar por toda a lista de categorias antes de chegar ao texto. */
    aside {
        width: 100%;
    }

    main {
        width: 100%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13.5px;
    }

    header {
        padding: 8px 10px;
        gap: 6px;
    }

    .site-title {
        font-size: 16px;
    }

    .site-subtitle {
        font-size: 10.5px;
    }

    .main-content {
        margin: 10px;
        gap: 10px;
    }

    main,
    aside {
        padding: 15px;
    }

    .sec,
    .seca {
        padding: 15px 16px;
    }

    .degr,
    .degra {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 20px;
    }
}

/* Telefones de quatro polegadas, na ordem dos 320 pixeis de largura. */
@media (max-width: 360px) {
    header {
        padding: 6px 8px;
    }

    .site-title {
        font-size: 15px;
    }

    .site-subtitle {
        font-size: 9.5px;
    }

    #openMenu,
    .interruptor-tema {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 14px;
    }

    .accoes-topo {
        gap: 5px;
    }

    .main-content {
        margin: 8px;
    }

    main,
    aside {
        padding: 12px;
        border-radius: 12px;
    }

    .degr,
    .degra {
        font-size: 13px;
        padding: 9px 12px;
    }

    footer p {
        font-size: 10px;
    }
}

/* Animacao usada pelo logotipo da pagina inicial. */
@keyframes colorChange {
    0% { color: #8b5cf6; }
    25% { color: #3b82f6; }
    50% { color: #10b981; }
    75% { color: #6366f1; }
    100% { color: #8b5cf6; }
}

.center-message span {
    display: inline-block;
    animation: colorChange 8s infinite;
    /* Cada letra entra com um atraso proprio. Sem o "backwards", durante
       esse atraso ficava com a cor normal do texto, o que no modo dia dava
       letras quase pretas com um halo escuro ao lado das ja coloridas. */
    animation-fill-mode: backwards;
    text-shadow: 0 0 15px currentColor;
}

.center-message span:nth-child(1) { animation-delay: 0s; }
.center-message span:nth-child(2) { animation-delay: 0.3s; }
.center-message span:nth-child(3) { animation-delay: 0.6s; }
.center-message span:nth-child(4) { animation-delay: 0.9s; }
.center-message span:nth-child(5) { animation-delay: 1.2s; }
.center-message span:nth-child(6) { animation-delay: 1.5s; }
.center-message span:nth-child(7) { animation-delay: 1.8s; }
.center-message span:nth-child(8) { animation-delay: 2.1s; }
.center-message span:nth-child(9) { animation-delay: 2.4s; }
.center-message span:nth-child(10) { animation-delay: 2.7s; }
.center-message span:nth-child(11) { animation-delay: 3.0s; }
.center-message span:nth-child(12) { animation-delay: 3.3s; }
