/* =====================================================================
    DESIGN SYSTEM & LAYOUT - TERRA PROMETIDA
    ==================================================================== */
:root, html[data-theme="light"], body[data-theme="light"] {
    --tp-bg-main: #f8fafc;
    --tp-surface: #ffffff;
    --tp-card-bg: #f1f5f9;
    --tp-card-hover-bg: #e2e8f0;
    --tp-border: #cbd5e1;
    --tp-border-strong: #94a3b8;
    --tp-text: #0f172a;
    --tp-text-muted: #475569;
    --tp-primary: #1f6f50;
    --tp-primary-hover: #18583f;
    --tp-primary-light: #e9f5ef;
    --tp-primary-dark: #174f3b;
    --tp-accent: #d4a72c;
    --tp-shadow-small: 0 4px 12px rgba(0, 0, 0, 0.05);
    --tp-shadow-large: 0 10px 28px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"], body[data-theme="dark"] {
    --tp-bg-main: #0f172a;
    --tp-surface: #1e293b;
    --tp-card-bg: #1e293b;
    --tp-card-hover-bg: #334155;
    --tp-border: #334155;
    --tp-border-strong: #475569;
    --tp-text: #f8fafc;
    --tp-text-muted: #94a3b8;
    --tp-primary: #22c55e;
    --tp-primary-hover: #16a34a;
    --tp-primary-light: rgba(34, 197, 94, 0.15);
    --tp-primary-dark: #4ade80;
    --tp-accent: #f59e0b;
    --tp-shadow-small: 0 4px 12px rgba(0, 0, 0, 0.35);
    --tp-shadow-large: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* Seletor Universal Corrigido */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Layout com altura total presa no ecrã (100vh) sem scroll no corpo */
body {
    background-color: var(--tp-bg-main);
    color: var(--tp-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* =====================================================================
    CABEÇALHO EM DUAS LINHAS (FIXO)
    ==================================================================== */
header.tp-header {
    background-color: var(--tp-surface);
    border-bottom: 1px solid var(--tp-border);
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
    z-index: 1000;
    box-shadow: var(--tp-shadow-small);
}

/* Linha 1: Marca e Botão de Tema */
.tp-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.tp-brand {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--tp-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.5px;
}

/* Barra de Navegação (Navbar) com Cascata Visível */
nav.tp-nav {
    display: flex;
    align-items: center;
    width: 100%;
    overflow: visible !important;
    padding-bottom: 0.25rem;
}

nav.tp-nav ul {
    list-style: none;
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

nav.tp-nav li {
    position: relative;
    overflow: visible;
}

nav.tp-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--tp-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

nav.tp-nav a:hover, 
nav.tp-nav li.active > a {
    color: var(--tp-primary);
    background-color: var(--tp-primary-light);
}

/* Submenus em Cascata (Nível 1) */
nav.tp-nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    background-color: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: 8px;
    box-shadow: var(--tp-shadow-large);
    min-width: 210px;
    padding: 0.4rem;
    z-index: 9999;
}

/* Submenus em Cascata (Nível 2 - Abertura Lateral) */
nav.tp-nav ul ul ul {
    top: 0;
    left: 100%;
    margin-left: 0.2rem;
}

/* Ativação por Hover */
nav.tp-nav li:hover > ul {
    display: flex;
}

.has-children > a::after {
    content: " ▾";
    font-size: 0.7rem;
    opacity: 0.8;
}

nav.tp-nav ul ul .has-children > a::after {
    content: " ▶";
    font-size: 0.6rem;
    opacity: 0.8;
}

.tp-theme-btn {
    background-color: var(--tp-card-bg);
    border: 1px solid var(--tp-border);
    color: var(--tp-text);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

/* Container Principal com Scroll Interno Dedicado */
main.tp-container {
    max-width: 1000px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem 2rem 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.card {
    background-color: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--tp-shadow-small);
}

.card h1 {
    color: var(--tp-primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 2px solid var(--tp-primary-light);
    padding-bottom: 0.5rem;
}

/* IMAGENS E GALERIAS DENTRO DO CONTAINER */
.page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 1rem auto;
    border-radius: 8px;
    object-fit: contain;
}

.page-content .wp-block-gallery,
.page-content .has-nested-images {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 1.25rem !important;
    width: 100% !important;
    box-sizing: border-box;
    margin: 1.5rem 0 !important;
}

.page-content .wp-block-image {
    margin: 0 !important;
    max-width: 100% !important;
}

.page-content .wp-block-image img {
    width: 100% !important;
    height: 240px !important;
    object-fit: cover;
    border-radius: 8px;
}

/* Rodapé Fixo na Base */
footer {
    text-align: center;
    padding: 1.25rem 2rem;
    color: var(--tp-text-muted);
    font-size: 0.85rem;
    background-color: var(--tp-surface);
    border-top: 1px solid var(--tp-border);
    flex-shrink: 0;
    width: 100%;
