/* =====================================================
   PERÍCIAS - PINDORAMA RPG
   CSS isolado da página pericias.php
   Pode ficar em: assets/css/pericias.css
   Observação: os seletores ficam escopados em .pericias-page
   para não quebrar outras páginas do projeto.
===================================================== */

:root {
    --purple: #69436f;
    --purple-dark: #3b1d43;
    --purple-deep: #2b1232;
    --purple-light: #e9d8f1;
    --pink-light: #f8d8ff;
    --paper: #fffdfd;
    --line: #76547c;
    --muted: #91739a;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 18px;
}

body.pericias-menu-open {
    overflow: hidden;
}

/* Correção: evita que overlays/transitions deixem a página ou o menu embaçados. */
body.pericias-menu-open,
body.pericias-menu-open * {
    filter: none !important;
}

body.pericias-menu-open .pericias-page {
    opacity: 1 !important;
    transform: none !important;
}

.pericias-page {
    width: min(1280px, 96vw);
    margin: 10px auto 32px;
}

.pericias-page .classes-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding: 22px 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 4px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(79, 49, 86, 0.16);
}

.pericias-page .classes-topbar h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    line-height: 0.95;
    color: var(--purple-dark);
}

.pericias-page .classes-topbar p {
    max-width: 780px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2.4vw, 1.45rem);
    line-height: 1.25;
}

.pericias-page .actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 220px;
}

.pericias-page .system-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 12px 22px;
    border: 3px solid var(--purple);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--purple);
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 900;
    transition: 0.2s ease;
}

.pericias-page .system-link-btn:hover {
    background: var(--purple);
    color: #fff;
    transform: translateY(-1px);
}

.pericias-page .classes-layout {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.pericias-page .classes-sidebar {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: hidden;
    padding: 18px 16px 16px;
    background: rgba(255, 255, 255, 0.82);
    border: 4px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(79, 49, 86, 0.14);
    z-index: 20;
}

.pericias-page .sidebar-mobile-head {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    min-height: 42px;
}

.pericias-page .panel-title {
    position: static;
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    background: var(--purple);
    color: #fff;
    padding: 8px 20px;
    border-radius: 14px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(79, 49, 86, 0.22);
}

.pericias-page .sidebar-close-btn {
    display: none;
}

.pericias-page .sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    padding-right: 4px;
}

.pericias-page .sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.pericias-page .sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(105, 67, 111, 0.35);
    border-radius: 999px;
}

.pericias-page .classes-search {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 3px solid rgba(118, 84, 124, 0.45);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--purple-dark);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
}

.pericias-page .classes-search:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(105, 67, 111, 0.12);
}

.pericias-page .classes-toc {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pericias-page .toc-link {
    display: block;
    padding: 11px 14px;
    border: 2px solid rgba(118, 84, 124, 0.28);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--purple-dark);
    text-decoration: none;
    font-weight: 900;
    line-height: 1.1;
    transition: 0.18s ease;
}

.pericias-page .toc-link:hover,
.pericias-page .toc-link.is-active {
    border-color: var(--purple);
    background: var(--purple-light);
    color: var(--purple-deep);
    transform: translateX(3px);
}

.pericias-page .toc-link[hidden] {
    display: none;
}

.pericias-page .classes-content {
    min-width: 0;
    padding: clamp(18px, 3vw, 34px);
    background:
        linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.97)),
        radial-gradient(circle at top right, rgba(198, 146, 230, 0.22), transparent 34%);
    border: 4px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(79, 49, 86, 0.16);
}

.pericias-page .content-section + .content-section {
    margin-top: 32px;
}

.pericias-page .content-section h2 {
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 4px solid var(--line);
    color: var(--purple-dark);
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.05;
}

.pericias-page .content-section p,
.pericias-page .content-section li {
    color: var(--purple-dark);
    font-size: clamp(1.03rem, 2.2vw, 1.35rem);
    line-height: 1.52;
}

.pericias-page .content-section p {
    margin: 0 0 16px;
}

.pericias-page .class-power-block {
    padding: 18px 20px;
    border-left: 7px solid rgba(105, 67, 111, 0.72);
    border-radius: 0 18px 18px 0;
    background: rgba(105, 67, 111, 0.055);
}

.pericias-page .class-power-block p:last-child {
    margin-bottom: 0;
}

.pericias-page .class-power-block strong {
    color: var(--purple-deep);
    font-weight: 900;
}

.pericias-page .section-tag {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--purple-light);
    color: var(--purple);
    font-size: 0.42em;
    font-weight: 900;
    white-space: nowrap;
}

.pericias-page .classes-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 18px 0;
    border: 3px solid rgba(118, 84, 124, 0.42);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.pericias-page .classes-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    color: var(--purple-dark);
}

.pericias-page .classes-table th,
.pericias-page .classes-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(118, 84, 124, 0.25);
    text-align: left;
    vertical-align: top;
}

.pericias-page .classes-table th {
    background: var(--purple);
    color: #fff;
    font-weight: 900;
}

.pericias-page .classes-table tr:last-child td {
    border-bottom: none;
}

.mobile-menu-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 58px;
    height: 58px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    border: none;
    border-radius: 50%;
    background: var(--purple);
    color: #fff;
    padding: 0;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 12px 28px rgba(59, 29, 67, 0.32);
}

.mobile-menu-toggle span {
    width: 26px;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
    transition: 0.18s ease;
}

.mobile-menu-toggle.is-open span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.mobile-menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

@media (max-width: 980px) {
    .mobile-menu-toggle.is-open {
        opacity: 0;
        pointer-events: none;
    }
}

/* O backdrop antigo causava o efeito roxo/desfocado por cima do menu em alguns navegadores.
   Nesta página, o menu abre sem camada bloqueadora. */
.pericias-sidebar-backdrop {
    display: none !important;
}

.back-to-top-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--purple);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--purple);
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: 0.18s ease;
    z-index: 800;
}

.back-to-top-btn.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top-btn:hover {
    background: var(--purple);
    color: #fff;
}

@media (max-width: 980px) {
    .pericias-page {
        width: min(100% - 20px, 720px);
        margin-top: 10px;
    }

    .pericias-page .classes-topbar {
        display: block;
        padding: 22px;
        padding-right: 76px;
    }

    .pericias-page .actions {
        min-width: 0;
        margin-top: 26px;
    }

    .pericias-page .classes-layout {
        display: block;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .pericias-page .classes-sidebar {
        position: fixed;
        top: 18px;
        left: 18px;
        width: min(420px, calc(100vw - 92px));
        max-height: calc(100dvh - 36px);
        transform: translateX(calc(-100% - 32px));
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s ease;
        z-index: 9999;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: none !important;
        filter: none !important;
    }

    .pericias-page .classes-sidebar.is-open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .pericias-page .sidebar-mobile-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 40px;
        margin-bottom: 10px;
    }

    .pericias-page .panel-title {
        position: static;
        display: inline-flex;
        width: auto;
        max-width: calc(100% - 58px);
    }

    .pericias-page .sidebar-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 2px solid var(--purple);
        border-radius: 50%;
        background: var(--purple);
        color: #fff;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
    }

    .pericias-page .sidebar-content {
        max-height: calc(100dvh - 120px);
    }

    .pericias-page .classes-content {
        margin-top: 20px;
    }
}

@media (max-width: 620px) {
    .pericias-page {
        width: calc(100% - 20px);
    }

    .pericias-page .classes-topbar {
        border-radius: 22px;
        padding: 20px 22px;
        padding-right: 76px;
    }

    .pericias-page .classes-topbar h1 {
        font-size: 2.45rem;
    }

    .pericias-page .classes-topbar p {
        font-size: 1.1rem;
    }

    .pericias-page .system-link-btn {
        min-height: 58px;
        font-size: 1.25rem;
    }

    .pericias-page .classes-content {
        padding: 20px;
        border-radius: 22px;
    }

    .pericias-page .content-section h2 {
        font-size: 2rem;
    }

    .pericias-page .content-section p,
    .pericias-page .content-section li {
        font-size: 1.13rem;
    }

    .pericias-page .class-power-block {
        padding: 16px;
    }
}

/* =====================================================
   ALINHAMENTO COM O PADRÃO DAS PÁGINAS DE REFERÊNCIA
   Esta camada neutraliza o visual antigo, maior e mais pesado,
   mantendo apenas o conteúdo específico de perícias.
===================================================== */

.pericias-page {
    width: min(1440px, 96vw);
    margin: 0 auto;
}

.pericias-page .classes-topbar {
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding: 8px 16px;
    border-width: 3px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(79, 49, 86, 0.12);
}

.pericias-page .classes-topbar h1 {
    margin: 0 0 4px;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1;
}

.pericias-page .classes-topbar p {
    max-width: none;
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
}

.pericias-page .classes-topbar .actions {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-top: 0;
}

.pericias-page .system-link-btn {
    min-height: 42px;
    padding: 9px 18px;
    border-width: 2px;
    border-radius: 12px;
    font-size: 1rem;
}

.pericias-page .classes-layout {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 18px;
}

.pericias-page .classes-sidebar {
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px 18px;
    border-radius: 18px;
    box-shadow: 0 16px 34px rgba(79, 49, 86, 0.08);
}

.pericias-page .sidebar-mobile-head {
    display: block;
    min-height: 0;
    margin-bottom: 0;
}

.pericias-page .classes-sidebar .panel-title {
    position: static;
    display: inline-block;
    margin: -42px 0 18px;
    padding: 8px 22px;
    border-radius: 0 0 14px 14px;
    font-size: 1rem;
}

.pericias-page .sidebar-content {
    display: block;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
}

.pericias-page .classes-search {
    min-height: 42px;
    margin-bottom: 14px;
    padding: 9px 12px;
    border: 2px solid var(--line);
    border-radius: 10px;
    font-size: 0.95rem;
}

.pericias-page .classes-toc {
    gap: 8px;
}

.pericias-page .toc-link {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
    border: 2px solid rgba(105, 67, 111, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    line-height: 1.2;
}

.pericias-page .toc-link:hover,
.pericias-page .toc-link.is-active,
.pericias-page .toc-link.active {
    background: var(--purple);
    color: #ffffff;
    transform: none;
}

.pericias-page .classes-content {
    padding: 22px;
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(79, 49, 86, 0.16);
}

.pericias-page .content-section + .content-section {
    margin-top: 28px;
}

.pericias-page .content-section h2 {
    margin: 0 0 14px;
    padding-bottom: 6px;
    border-bottom: 3px solid var(--line);
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
}

.pericias-page .content-section p,
.pericias-page .content-section li {
    font-size: 1rem;
    line-height: 1.65;
}

.pericias-page .class-power-block {
    padding: 12px 14px;
    border-left: 4px solid rgba(105, 67, 111, 0.72);
    border-radius: 0 10px 10px 0;
}

@media (max-width: 980px) {
    .pericias-page {
        width: min(100%, 94vw);
        margin: 0 auto;
        padding-bottom: 90px;
    }

    .pericias-page .classes-topbar {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
    }

    .pericias-page .classes-topbar .actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .pericias-page .system-link-btn {
        width: 100%;
        min-height: 46px;
    }

    .pericias-page .classes-layout {
        display: block;
    }

    .pericias-page .classes-sidebar {
        top: 0;
        left: 0;
        z-index: 10010;
        width: min(86vw, 360px);
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        padding: 22px 20px;
        overflow-y: auto;
        border-radius: 0 22px 22px 0;
        border-width: 0 4px 0 0;
        background: rgba(255, 250, 255, 0.98);
        box-shadow: 18px 0 40px rgba(40, 20, 50, 0.25);
        transform: translateX(-105%);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: transform 0.28s ease;
    }

    .pericias-page .classes-sidebar.is-open {
        transform: translateX(0);
    }

    .pericias-page .sidebar-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 16px;
    }

    .pericias-page .classes-sidebar .panel-title {
        margin: 0;
        padding: 0;
        border-radius: 0;
        background: transparent;
        color: var(--purple-dark);
        box-shadow: none;
        font-size: 1.1rem;
    }

    .pericias-page .sidebar-content {
        display: block;
        max-height: none;
    }

    .mobile-menu-toggle {
        top: 22px;
        right: 18px;
        z-index: 10020;
        display: inline-flex;
        gap: 5px;
        width: 54px;
        height: 54px;
        border: 3px solid var(--purple);
        background: rgba(255, 255, 255, 0.98);
        color: var(--purple);
        box-shadow: 0 10px 28px rgba(50, 20, 60, 0.25);
    }

    .mobile-menu-toggle span {
        width: 23px;
        height: 3px;
        background: currentColor;
    }

    .mobile-menu-toggle.is-open {
        opacity: 1;
        pointer-events: auto;
        background: var(--purple);
        color: #ffffff;
    }

    .pericias-page .classes-content {
        margin-top: 20px;
        padding: 22px 18px;
    }
}

@media (max-width: 480px) {
    .pericias-page {
        width: min(100%, 92vw);
    }

    .pericias-page .classes-topbar {
        padding: 15px;
    }

    .pericias-page .classes-topbar h1 {
        font-size: 1.75rem;
    }

    .pericias-page .classes-topbar p {
        font-size: 0.9rem;
    }

    .pericias-page .classes-topbar .actions {
        grid-template-columns: 1fr;
    }

    .mobile-menu-toggle {
        top: 18px;
        right: 12px;
        width: 48px;
        height: 48px;
    }

    .pericias-page .classes-content {
        padding: 20px 15px;
    }

    .pericias-page .content-section h2 {
        font-size: 1.45rem;
    }

    .pericias-page .content-section p,
    .pericias-page .content-section li {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}
