/* ============================================
   SISTEMA TERNÁRIO - INDEX.HTML
   Revolução Cibernética - Ontologia Executável
   ============================================ */

/* Canvas Background Filosófico */
#philosophy-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.25;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Responsivo: reduzir opacidade em mobile */
@media (max-width: 768px) {
    #philosophy-canvas {
        opacity: 0.15;
    }
}

/* Header Ternário */
.ternary-header {
    background: transparent;
    padding: 2rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: none;
}

.ternary-header h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--vermelho), var(--verde), var(--azul));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    font-weight: 700;
    text-align: left;
}

.ternary-subtitle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.ternary-subtitle span {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ternary-subtitle .past {
    background: linear-gradient(135deg, var(--vermelho-claro), var(--vermelho));
    color: white;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.3);
}

.ternary-subtitle .present {
    background: linear-gradient(135deg, var(--verde-claro), var(--verde));
    color: white;
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3);
}

.ternary-subtitle .future {
    background: linear-gradient(135deg, var(--azul-claro), var(--azul));
    color: white;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* Controles Guaiamum (Navegação Ternária) */
.guaiamum-nav {
    display: flex;
    justify-content: left;
    gap: 1rem;
    margin-top: 1.5rem;
}

.guaiamum-nav button {
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--vermelho), var(--verde), var(--azul));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.guaiamum-nav button:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
}

.guaiamum-nav button.active {
    background: linear-gradient(135deg, var(--verde-claro), var(--verde));
    box-shadow: 0 0 30px rgba(5, 150, 105, 0.8);
    border-color: rgba(5, 150, 105, 0.5);
}

.guaiamum-nav button:focus {
    outline: 2px solid var(--azul-claro);
    outline-offset: 2px;
}

/* Conteúdo em Camadas */
.layered-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.layer {
    min-height: 80vh;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Seções Destacadas */
.featured-section {
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid var(--azul);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.2);
}

.featured-section h2 {
    font-size: 1.625rem;
    margin-bottom: 1rem;
    color: var(--azul);
}

.lead {
    font-size: 1.125rem;
    color: var(--azul-claro);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Grid de Insights */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.insight-card {
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid var(--azul);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.insight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.insight-card h3 {
    color: var(--azul-claro);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.insight-card blockquote {
    border-left: 4px solid var(--vermelho);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--vermelho-claro);
    background: rgba(220, 38, 38, 0.1);
    padding: 1rem;
    border-radius: 4px;
}

.insight-card p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Botões de Demonstração */
.demo-btn {
    background: linear-gradient(135deg, var(--verde-claro), var(--verde));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.demo-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(5, 150, 105, 0.4);
}

.demo-btn:active {
    transform: scale(0.98);
}

/* Técnicas de Resistência */
.technique-showcase {
    display: grid;
    gap: 2rem;
}

.technique {
    background: rgba(5, 150, 105, 0.1);
    border: 2px solid var(--verde);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.technique:hover {
    border-color: var(--verde-claro);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.2);
}

.technique h3 {
    color: var(--verde);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.technique pre {
    background: #1a1a2e;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.technique code {
    color: var(--azul-claro);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.technique ul {
    list-style-type: none;
    padding-left: 0;
}

.technique ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.technique ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--verde);
    font-weight: bold;
}

.test-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--verde), var(--azul));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.test-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(5, 150, 105, 0.4);
}

/* Demo de Sistema Ternário */
.ternary-demo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
    background: rgba(26, 26, 46, 0.5);
    padding: 1rem;
    border-radius: 8px;
}

.counter-state {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.counter-state code {
    background: #1a1a2e;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--verde);
    font-size: 1rem;
    border: 1px solid rgba(5, 150, 105, 0.3);
    min-width: 120px;
    text-align: center;
}

.counter-state span {
    color: var(--azul-claro);
    font-size: 0.9rem;
}

/* Grid de Capítulos */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.chapter-card {
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chapter-card:hover {
    transform: translateY(-3px);
    border-color: var(--azul);
    box-shadow: 0 5px 20px rgba(37, 99, 235, 0.2);
}

/* Timeline (Camada Passado) */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--vermelho), var(--verde), var(--azul));
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 2rem;
    padding-bottom: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--azul);
    box-shadow: 0 0 10px var(--azul);
    border: 2px solid #1a1a2e;
}

.timeline-item .year {
    display: inline-block;
    background: #1a1a2e;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    color: var(--azul-claro);
    font-weight: bold;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.timeline-item h3 {
    color: var(--vermelho);
    margin: 0.5rem 0;
    font-size: 1.05rem;
}

.timeline-item p {
    color: #d1d5db;
    line-height: 1.6;
}

/* Grid Futuro */
.future-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.future-card {
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid var(--azul);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.future-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.future-card h3 {
    color: var(--azul-claro);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.future-card p {
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.future-card ul {
    list-style-type: none;
    padding-left: 0;
    margin: 1rem 0;
}

.future-card ul li {
    padding: 0.25rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #d1d5db;
}

.future-card ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--azul);
}

.status-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--azul);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.status-dev {
    border-color: var(--verde);
}

.status-dev .status-badge {
    background: var(--verde);
}

.status-experimental {
    border-color: var(--vermelho);
}

.status-experimental .status-badge {
    background: var(--vermelho);
}

.status-planned {
    border-color: var(--azul);
}

.status-planned .status-badge {
    background: var(--azul);
}

/* Botões de Navegação entre Camadas */
.navigate-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--vermelho), var(--verde), var(--azul));
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 2rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.navigate-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
}

.navigate-btn:active {
    transform: scale(0.98);
}

/* Responsividade */
@media (max-width: 768px) {
    .ternary-header {
        padding: 1.5rem 1rem;
    }

    .ternary-header h1 {
        font-size: 1.5rem;
    }

    .ternary-subtitle {
        flex-direction: column;
        gap: 0.5rem;
    }

    .ternary-subtitle span {
        width: 100%;
        text-align: center;
    }

    .guaiamum-nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .guaiamum-nav button {
        width: 100%;
    }

    .insights-grid,
    .future-grid {
        grid-template-columns: 1fr;
    }

    .layered-content {
        padding: 1rem;
    }

    .featured-section {
        padding: 1.5rem;
    }

    .lead {
        font-size: 1rem;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ternary-header h1 {
        font-size: 1.375rem;
    }

    .featured-section h2 {
        font-size: 1.375rem;
    }

    .insight-card h3 {
        font-size: 1.125rem;
    }
}

/* Animações e Transições */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.pulsing {
    animation: pulse 2s ease-in-out infinite;
}

/* Estados de loading */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Acessibilidade */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--azul);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Print styles */
@media print {

    #philosophy-canvas,
    .guaiamum-nav {
        display: none;
    }

    .layer {
        display: block !important;
    }

    .featured-section {
        border: 1px solid #333;
        page-break-inside: avoid;
    }
}

/* ============================================
   OVERLAY DE BLOQUEIO DE TRANSIÇÃO
   Previne spam de cliques durante mudanças de camada
   ============================================ */

.ternary-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ternary-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
    cursor: wait;
}

/* Indicador de carregamento (opcional) */
.ternary-transition-overlay::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 3px solid rgba(37, 99, 235, 0.3);
    border-top-color: var(--azul);
    border-radius: 50%;
    animation: ternary-spin 0.8s linear infinite;
}

@keyframes ternary-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Variação para mobile: overlay mais escuro */
@media (max-width: 768px) {
    .ternary-transition-overlay {
        background: rgba(0, 0, 0, 0.6);
    }
}