/* ROOTS Design Equality 2025 - Custom Styles */

/* Base Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-fade-in {
    animation: fadeIn 1.5s ease-out forwards;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Reveal Animation Classes */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax Background */
.parallax-bg {
    will-change: transform;
    transform: translateZ(0);
}

/* Scroll Indicator */
.scroll-indicator {
    animation: pulse 2s ease-in-out infinite;
}

/* System Diagram Animations */
.flow-line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1.5s ease-out;
}

.flow-line.active {
    stroke-dashoffset: 0;
}

.ecology-ring {
    animation: rotate 60s linear infinite;
    transform-origin: 400px 250px;
}

.pillar-node {
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

.pillar-node:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Cards */
.pain-card {
    transition: all 0.3s ease;
}

.pain-card:hover {
    transform: translateX(8px);
}

.dimension-card {
    transition: transform 0.3s ease;
}

.dimension-card:hover {
    transform: translateY(-5px);
}

/* Exploded View Layers */
.layer-group {
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.layer-group.highlighted {
    transform: translateY(-20px);
}

.layer-group.dimmed {
    opacity: 0.3;
}

/* Flywheel Animation */
.flywheel {
    transition: transform 0.5s ease;
}

.flywheel:hover {
    transform: rotate(30deg);
}

/* Timeline */
.timeline-item {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.5s ease;
}

.timeline-item.active {
    opacity: 1;
    transform: translateX(0);
}

/* Risk Cards */
.risk-card {
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.risk-card .risk-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.risk-card.expanded .risk-content {
    max-height: 500px;
    padding-top: 1rem;
}

/* Counter Animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Map Zoom Animation */
.map-layer {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.map-layer.visible {
    opacity: 1;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
}

/* Gradient Backgrounds */
.gradient-pink-green {
    background: linear-gradient(135deg, #fce7f3 0%, #dcfce7 100%);
}

.gradient-forest {
    background: linear-gradient(180deg, #14532d 0%, #166534 50%, #15803d 100%);
}

/* Text Gradients */
.text-gradient {
    background: linear-gradient(135deg, #ec4899 0%, #22c55e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Stakeholder Matrix */
.stakeholder-dot {
    transition: transform 0.3s ease, r 0.3s ease;
    cursor: pointer;
}

.stakeholder-dot:hover {
    transform: scale(1.3);
}

/* Impact Counter */
.impact-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .system-diagram-container svg {
        height: auto;
    }

    .impact-number {
        font-size: 2rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f0fdf4;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ec4899, #22c55e);
    border-radius: 4px;
}

/* Selection Color */
::selection {
    background: #fbcfe8;
    color: #15803d;
}

/* Focus States for Accessibility */
a:focus,
button:focus {
    outline: 2px solid #ec4899;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    @page {
        size: 330mm 215mm;
        /* Folio Landscape */
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        width: 330mm;
        background: white;
    }

    /* Hide UI elements not needed for deck */
    #main-nav,
    #mobile-menu-btn,
    .scroll-indicator,
    .nav-group,
    .nav-dropdown,
    #mobile-menu {
        display: none !important;
    }

    /* Force all animations to end state */
    .reveal,
    .animate-fade-in,
    .timeline-item,
    .layer-group.highlighted,
    .layer-group.dimmed,
    .map-layer {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    /* Section as Slide Configuration */
    section {
        position: relative;
        width: 330mm;
        height: 215mm;
        /* Fixed height for slide */
        page-break-after: always;
        break-after: page;
        overflow: hidden;
        /* Prevent spillover */
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 20mm !important;
        /* Safe margin */
        box-sizing: border-box;
    }

    /* Specific Adjustments for Cover to fit */
    #cover {
        background-size: cover;
        background-position: center;
    }

    #cover h1 {
        font-size: 5rem;
        /* Slightly smaller for print safety */
    }

    /* Adjust grids for landscape width */
    .max-w-6xl {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Prevent breaking inside cards */
    .pain-card,
    .stat-card,
    .dimension-card,
    .risk-card,
    blockquote {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Diagram Scaling */
    svg {
        max-height: 100mm;
        width: auto;
    }

    /* Font resizing for readability in deck format */
    p {
        font-size: 14pt;
    }

    h1 {
        font-size: 48pt;
    }

    h2 {
        font-size: 32pt;
    }

    h3 {
        font-size: 24pt;
    }

    h4 {
        font-size: 18pt;
    }

    /* Chart.js Canvas Specific */
    canvas {
        max-width: 100% !important;
        max-height: 100% !important;
    }

    .chart-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Issue Tree horizontal scroll fix for PDF */
    .overflow-x-auto {
        overflow: visible !important;
    }

    .min-w-\[950px\] {
        min-width: 0 !important;
        width: 100% !important;
        transform: scale(0.85);
        /* Scale down large diagrams to fit */
        transform-origin: top left;
    }
}

/* Risk Card Styles */
.risk-card {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.risk-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.risk-card .toggle-icon {
    transition: transform 0.3s ease;
    font-weight: bold;
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
}

.risk-card.expanded .toggle-icon {
    transform: rotate(45deg);
}

.risk-card .risk-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease-out, opacity 0.25s ease-out;
}

.risk-card.expanded .risk-content {
    opacity: 1;
}

/* Inner content wrapper */
.risk-card .risk-content>div {
    padding: 0 1rem 1rem 1rem;
}

.risk-card .risk-header {
    transition: background-color 0.2s ease;
    user-select: none;
}

.risk-card .risk-header:active {
    transform: scale(0.99);
}

/* Detail Cards Styling */
.detail-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border-top: 4px solid;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.detail-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.detail-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.detail-card-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.detail-card-desc {
    color: #4b5563;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.detail-card-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.detail-card-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.5;
}

.detail-card-list li .bullet {
    font-weight: 700;
    flex-shrink: 0;
}

.detail-card-list li .label {
    font-weight: 600;
    color: #374151;
}

.detail-card-footer {
    margin-top: auto;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
}

.detail-card-footer strong {
    color: inherit;
}