/* =====================================================================
   FACMAR — ajustes de layout para celular e tablet
   Carregado depois de style.min.css e responsive.min.css.
   Nada aqui vale acima de 991px: o desktop permanece como está.
   - Até 991px: cabeçalho e menu recolhido (o mesmo menu ☰ do tema).
   - Até 767px: conteúdo das páginas.
   Identidade mantida: bordô #80171a, branco, Lato no menu, Open Sans no texto.
   ===================================================================== */

:root {
    --fm-bordo: #80171a;
    --fm-bordo-escuro: #6a1215;
    --fm-branco: #fff;
    --fm-linha: rgba(255, 255, 255, 0.14);
    --fm-barra: 72px;
    --fm-margem: 16px;
    --fm-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* Botão do submenu criado por menu-mobile.js: só existe no menu recolhido */
.submenu-toggle {
    display: none;
}

/* Atalhos "Área do ..." do topo: ícone e rótulo em duas linhas só no celular.
   Fora dele vale o texto original (.area-atalho-texto), intacto. */
.area-atalho-icone,
.area-atalho-rotulo {
    display: none !important;
}

/* =====================================================================
   1. CABEÇALHO E MENU (até 991px)
   ===================================================================== */
@media (max-width: 991px) {

    header.main-header {
        background: transparent;
    }

    /* Faixa de links do topo: mais compacta */
    header.main-header .top-header {
        padding: 10px 0 12px;
    }
    header.main-header .top-header > .container {
        padding: 0 15px !important;   /* algumas páginas redefinem .container */
    }
    header.main-header .top-header div.left-side > ul {
        margin: 0 !important;
        padding: 0;
        line-height: 1.6;
    }

    /* A faixa bordô ocupa a largura toda, como no estado fixo */
    header.main-header #ctn_menu {
        width: 100%;
        max-width: none;
        padding: 0 !important;
        margin: 0;
    }
    header.main-header .main-menu-wrapper,
    header.main-header .main-menu-wrapper.fixed {
        margin: 0 !important;
        background: var(--fm-bordo);
        overflow: visible;
        max-height: none;
        z-index: 999;
    }
    header.main-header .main-menu-wrapper:not(.fixed) {
        position: relative;
    }

    /* Barra: logo à esquerda, ☰ à direita */
    header.main-header .main-menu-wrapper > .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: none;
        min-height: var(--fm-barra);
        margin: 0;
        padding: 4px var(--fm-margem) !important;
        position: static;
    }
    header.main-header .main-menu-wrapper > .container::before,
    header.main-header .main-menu-wrapper > .container::after {
        display: none;
    }

    header.main-header .main-menu-wrapper .logo,
    header.main-header .main-menu-wrapper.fixed .logo {
        position: static !important;
        float: none;
        top: auto;
        left: auto;
        margin: 0;
        line-height: 0;
    }
    header.main-header .main-menu-wrapper .logo a {
        display: inline-block;
    }
    header.main-header .main-menu-wrapper .logo img {
        width: auto !important;
        height: 62px;   /* o PNG (160x100) tem margem transparente */
        max-width: none;
    }

    /* A busca do cabeçalho não tem destino (action="#", campo sem name) */
    header.main-header .main-menu-wrapper form {
        display: none !important;
    }

    header.main-header nav#menu {
        position: static;
        float: none;
        margin: 0;
        min-height: 0;
    }
    header.main-header nav#menu .navbar-header {
        float: none;
        margin: 0 !important;
    }

    /* Botão ☰ — 44px de área de toque, vira X quando o menu abre */
    header.main-header .navbar-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        float: none;
        width: 46px;
        height: 44px;
        margin: 0 !important;
        padding: 0;
        border: 1px solid var(--fm-branco);
        border-radius: 4px;
        background: transparent;
        transition: transform 140ms var(--fm-ease-out), background-color 160ms ease;
    }
    header.main-header .navbar-toggle .icon-bar {
        display: block;
        width: 24px;
        height: 2px;
        margin: 0 !important;
        border-radius: 1px;
        background-color: var(--fm-branco);
        transition: transform 200ms var(--fm-ease-out), opacity 160ms ease;
    }
    header.main-header .navbar-toggle:active {
        transform: scale(0.96);
    }
    header.main-header .navbar-toggle[aria-expanded="true"] {
        background: var(--fm-bordo-escuro);
    }
    header.main-header .navbar-toggle[aria-expanded="true"] .icon-bar:nth-of-type(2) {
        transform: translateY(7px) rotate(45deg);
    }
    header.main-header .navbar-toggle[aria-expanded="true"] .icon-bar:nth-of-type(3) {
        opacity: 0;
    }
    header.main-header .navbar-toggle[aria-expanded="true"] .icon-bar:nth-of-type(4) {
        transform: translateY(-7px) rotate(-45deg);
    }
    header.main-header .navbar-toggle:focus {
        outline: none;
    }
    header.main-header .navbar-toggle:focus-visible {
        outline: 2px solid var(--fm-branco);
        outline-offset: 3px;
    }

    /* Painel do menu: desce logo abaixo da barra, sobre o conteúdo */
    header.main-header #navbar-collapse-1 {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 0 !important;
        padding: 0 !important;
        border: 0;
        border-top: 1px solid var(--fm-linha);
        background: var(--fm-bordo);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
        max-height: calc(100vh - var(--fm-barra));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    header.main-header #navbar-collapse-1.collapsing {
        overflow: hidden;
    }

    header.main-header .main-menu-wrapper .navbar-nav {
        float: none;
        margin: 0 !important;
        padding: 0 0 8px;
        border: 0 !important;
        list-style: none;
    }
    header.main-header .main-menu-wrapper .nav > li {
        float: none;
        margin: 0 !important;
        position: relative;
        border-bottom: 1px solid var(--fm-linha);
    }
    header.main-header .main-menu-wrapper .nav > li:last-child {
        border-bottom: 0;
    }
    header.main-header .main-menu-wrapper .nav > li > a {
        display: block;
        min-height: 52px;
        padding: 16px 68px 16px var(--fm-margem);
        border: 0 !important;
        color: var(--fm-branco);
        font-size: 15px;
        font-weight: 700;
        line-height: 20px;
        letter-spacing: 0.02em;
        white-space: normal;
        transition: background-color 160ms ease;
    }
    header.main-header .main-menu-wrapper .nav > li > a:active {
        background-color: rgba(0, 0, 0, 0.16);
    }
    /* Página atual: barra branca à esquerda (no desktop é o sublinhado branco) */
    header.main-header .main-menu-wrapper .nav > li.current-page-item > a {
        box-shadow: inset 4px 0 0 var(--fm-branco);
    }
    header.main-header .main-menu-wrapper .nav > li > a:focus {
        outline: none;
    }
    header.main-header .main-menu-wrapper .nav > li > a:focus-visible,
    header.main-header .main-menu-wrapper .sub-menu a:focus-visible {
        outline: 2px solid var(--fm-branco);
        outline-offset: -4px;
    }

    /* Seta do tema substituída pelo botão .submenu-toggle (menu-mobile.js) */
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder > .fa {
        display: none !important;
    }
    header.main-header .submenu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        right: 0;
        width: 56px;
        height: 52px;
        padding: 0;
        border: 0;
        border-left: 1px solid var(--fm-linha);
        background: transparent;
        color: var(--fm-branco);
        cursor: pointer;
        transition: background-color 160ms ease;
    }
    header.main-header .submenu-toggle svg {
        width: 18px;
        height: 18px;
        transition: transform 200ms var(--fm-ease-out);
    }
    header.main-header .submenu-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }
    header.main-header .submenu-toggle:active {
        background-color: rgba(0, 0, 0, 0.16);
    }
    header.main-header .submenu-toggle:focus {
        outline: none;
    }
    header.main-header .submenu-toggle:focus-visible {
        outline: 2px solid var(--fm-branco);
        outline-offset: -4px;
    }

    /* Submenus: degrau de tom mais escuro, recuados */
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu {
        display: none;
        position: static;
        width: 100%;
        margin: 0;
        padding: 4px 0 8px;
        list-style: none;
        background: var(--fm-bordo-escuro);
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
        box-shadow: none;
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li {
        margin: 0;
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li a {
        display: block;
        padding: 12px var(--fm-margem) 12px 32px;
        border: 0;
        color: var(--fm-branco);
        font-size: 14px;
        line-height: 20px;
        white-space: normal;
        transition: background-color 160ms ease;
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li a:before {
        display: none;
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li a:hover,
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li a:focus {
        color: var(--fm-branco);
        background: transparent;
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li a:active {
        background-color: rgba(0, 0, 0, 0.2);
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu li a .fa {
        display: none !important;
    }
    header.main-header .main-menu-wrapper .nav > li.dropdown-holder .sub-menu abbr {
        border: 0;
        text-decoration: none;
        cursor: inherit;
    }
}

/* Tablet: a faixa de links do topo e os ícones sociais ficam em linhas próprias */
@media (min-width: 768px) and (max-width: 991px) {
    header.main-header .top-header div.right-side {
        margin-top: 6px;
    }
}

/* =====================================================================
   2. CONTEÚDO DAS PÁGINAS (até 767px)
   ===================================================================== */
@media (max-width: 767px) {

    /* Atalhos "Área do Candidato / Aluno / Professor": três colunas iguais,
       cada uma inteira tocável, com ícone e o nome em destaque */
    header.main-header .top-header {
        padding: 0;
        background: var(--fm-branco);
    }
    header.main-header .top-header > .container {
        padding: 0 !important;
    }
    header.main-header .top-header div.left-side > ul {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        margin: 0 !important;
        padding: 0;
        line-height: 1.2;
    }
    header.main-header .top-header a.area-atalho {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 0;
        padding: 3px 4px 4px;
        text-align: center;
        color: var(--fm-bordo);
        -webkit-tap-highlight-color: transparent;
        transition: background-color 160ms ease;
    }
    /* divisória curta entre os atalhos */
    header.main-header .top-header a.area-atalho + a.area-atalho::before {
        content: "";
        position: absolute;
        left: 0;
        top: 10px;
        bottom: 10px;
        width: 1px;
        background: #eadfdf;
    }
    header.main-header .top-header .area-atalho-icone {
        display: block !important;
        margin-bottom: 1px;
        font-size: 13px;
        line-height: 1;
        color: var(--fm-bordo);
        transition: transform 140ms var(--fm-ease-out);
    }
    header.main-header .top-header .area-atalho-texto {
        display: none;
    }
    header.main-header .top-header .area-atalho-rotulo {
        display: block !important;
    }
    header.main-header .top-header .area-atalho-pre {
        display: block;
        font-size: 12px;
        line-height: 1.1;
        color: #6f6f6f;
    }
    header.main-header .top-header .area-atalho-nome {
        display: block;
        font-size: 14px;
        line-height: 1.1;
        font-weight: 600;
        color: var(--fm-bordo);
    }
    header.main-header .top-header a.area-atalho:active {
        background-color: #f6eeee;
    }
    header.main-header .top-header a.area-atalho:active .area-atalho-icone {
        transform: scale(0.9);
    }
    header.main-header .top-header a.area-atalho:focus {
        outline: none;
    }
    header.main-header .top-header a.area-atalho:focus-visible {
        outline: 2px solid var(--fm-bordo);
        outline-offset: -4px;
    }

    /* Newsletter: o campo hidden (uri_origem) aparecia com o caminho da página */
    .subscribe-banner input[hidden] {
        display: none !important;
    }
    .subscribe-banner input[type="email"] {
        font-size: 16px;
    }

    /* Títulos de seção: duas linhas no máximo */
    .section-title h2 {
        font-size: 27px;
        line-height: 1.12;
    }

    /* Botões "Ver todos os eventos / notícias" colados na borda direita */
    .row > .course-button.pull-right {
        float: none !important;
        clear: both;
        display: block;
        width: auto;
        margin: 24px 15px 0;
        text-align: center;
    }

    /* Páginas internas: o texto ganhava 50px de margem de cada lado */
    .course-details-page .course-details-content .sub-text {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    .course-details-page .course-details-content .sub-text p,
    .course-details-page .course-details-content .sub-text li {
        font-size: 16px;
        line-height: 1.65;
    }
    .course-details-page .course-details-content .sub-text iframe {
        width: 100%;
    }
    /* <br> soltos usados no desktop para alinhar com a barra lateral */
    .course-details-page .course-details-content > br {
        display: none;
    }

    /* Listas de notícias e eventos: a linha da paginação vinha logo depois
       das colunas flutuantes, sem clear; com position:relative ela ficava
       por cima dos cartões e capturava todo toque (nenhuma notícia abria). */
    .latest-news .post-wrapper > .row,
    .event-section > .container > .row {
        clear: both;
    }

    /* Cartão de notícia inteiro tocável: o link do título se estende sobre
       o cartão (a coluna .single-post já é position:relative). */
    .latest-news .single-post .text-wrapper .text > a::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 3;
    }
    /* O overlay da imagem (efeito de hover do desktop) fica fora do caminho */
    .latest-news .img-holder > a {
        display: none;
    }
    /* Cartão de evento inteiro tocável (a coluna também é position:relative) */
    .event-section .single-event > a::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 3;
    }

    /* Toque: sem o "hover grudado" (fundo bordô que ficava após tocar);
       o bordô aparece só enquanto o dedo pressiona o cartão */
    .latest-news .single-post .text-wrapper .text {
        transition: background-color 160ms ease;
    }
    .latest-news .single-post:hover .text-wrapper .text {
        background: #fff;
    }
    .latest-news .single-post:hover .text-wrapper .text a {
        color: #333333;
    }
    .latest-news .single-post:hover .text-wrapper .text p,
    .latest-news .single-post:hover .text-wrapper .text span,
    .latest-news .single-post:hover .text-wrapper .text i {
        color: #6f6f6f;
    }
    .latest-news .single-post:active .text-wrapper .text {
        background: var(--fm-bordo);
    }
    .latest-news .single-post:active .text-wrapper .text a,
    .latest-news .single-post:active .text-wrapper .text p,
    .latest-news .single-post:active .text-wrapper .text span,
    .latest-news .single-post:active .text-wrapper .text i {
        color: var(--fm-branco);
    }
    .latest-news .single-post .text-wrapper .text > a:focus-visible {
        outline: 2px solid var(--fm-bordo);
        outline-offset: 4px;
    }

    /* Rodapé: caixas de contato na largura toda, sem altura fixa */
    footer .top-footer .footer-contact ul li {
        width: 100% !important;
        height: auto !important;
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 16px;
    }
}

/* Movimento reduzido: sem deslocamentos, só as trocas de cor */
@media (prefers-reduced-motion: reduce) {
    header.main-header .navbar-toggle,
    header.main-header .navbar-toggle .icon-bar,
    header.main-header .submenu-toggle svg,
    header.main-header .top-header .area-atalho-icone {
        transition: none;
    }
}
