/* ==========================================================================
   CSS Variables & Resets
   ========================================================================== */
:root {
    --primary: #215CA8; /* theoremblue from paper */
    --primary-light: #4A83D0;
    --primary-dark: #123C73;
    --secondary: #787878; /* remarkgray from paper */
    --accent: #E2E8F0;
    
    --bg-main: #FFFFFF;
    --bg-alt: #F8FAFC;
    --bg-card: rgba(255, 255, 255, 0.8);
    
    --text-main: #0F172A;
    --text-muted: #475569;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==========================================================================
   Typography & Layout Utilities
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-main);
    line-height: 1.2;
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 6rem 0;
}

.section-alt {
    background-color: var(--bg-alt);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

.text-center {
    text-align: center;
}

.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }

/* ==========================================================================
   Navigation
   ========================================================================== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--accent);
    z-index: 1000;
    transition: var(--transition);
}

#navbar.scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 0 4rem;
    background: linear-gradient(135deg, #f0f4f8 0%, #e0eaf5 100%);
    overflow: hidden;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-logo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2rem;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero .subtitle {
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero .venue {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2rem;
}

.authors {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    font-size: 1.2rem;
    color: var(--text-main);
}

.authors span {
    position: relative;
}

.authors span:not(:last-child)::after {
    content: ',';
}

/* Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(33, 92, 168, 0.39);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 92, 168, 0.23);
}

.btn-secondary {
    background-color: var(--text-main);
    color: white;
}

.btn-secondary:hover {
    background-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background-color: rgba(33, 92, 168, 0.05);
    transform: translateY(-2px);
}

/* Wave Divider */
.wave-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    transform: rotate(180deg);
}

.wave-divider svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
    transform: rotateY(180deg);
}

.wave-divider .shape-fill {
    fill: #FFFFFF;
}

/* ==========================================================================
   Abstract Section
   ========================================================================== */
.abstract-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    font-size: 1.1rem;
    line-height: 1.8;
}

.abstract-card p {
    color: var(--text-main);
}

.abstract-card p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Methodology & Layouts
   ========================================================================== */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.layout-reverse .chart-content {
    order: 2;
}

.layout-reverse .chart-image {
    order: 1;
}

.method-content h3, .chart-content h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.feature-list {
    list-style: none;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.feature-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.feature-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.feature-list strong {
    color: var(--text-main);
}

.highlight-box {
    background-color: rgba(33, 92, 168, 0.05);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.highlight-box code {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--primary-dark);
}

.image-wrapper {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--accent);
    transition: var(--transition);
}

.image-wrapper:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.image-wrapper figcaption {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* ==========================================================================
   Results Section
   ========================================================================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.result-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--accent);
    display: flex;
    flex-direction: column;
}

.result-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.result-card .image-wrapper {
    margin-top: auto;
    padding: 0.5rem;
    box-shadow: none;
    border-color: transparent;
}

.result-card .image-wrapper:hover {
    transform: scale(1.02);
    box-shadow: none;
}

/* ==========================================================================
   Resources Section
   ========================================================================== */
.resource-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.resource-card {
    display: block;
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--accent);
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.resource-icon {
    width: 64px;
    height: 64px;
    background: rgba(33, 92, 168, 0.1);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: var(--transition);
}

.hover-lift:hover .resource-icon {
    background: var(--primary);
    color: white;
}

.resource-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.resource-card p {
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    background-color: var(--text-main);
    color: white;
    padding: 3rem 0;
}

footer p {
    color: #94a3b8;
    margin: 0;
}

/* ==========================================================================
   Animations
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-in {
    animation: fadeIn 1s ease forwards;
}

.animate-slide-up {
    opacity: 0;
    animation: slideUp 0.8s cubic-bezier(0.5, 0, 0, 1) forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 992px) {
    .grid-2-col {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .layout-reverse .chart-content {
        order: 1;
    }
    
    .layout-reverse .chart-image {
        order: 2;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero .subtitle {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none; /* simple mobile nav */
    }
    
    .section {
        padding: 4rem 0;
    }
    
    .hero {
        padding: 6rem 0 3rem;
    }
    
    .abstract-card {
        padding: 2rem;
    }
    
    .chat-container {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Chat / Agent Integration
   ========================================================================== */
.chat-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.chat-sidebar {
    border-right: 1px solid var(--accent);
    padding-right: 1.5rem;
}

.chat-sidebar h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.chat-help {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.domain-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.domain-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.chat-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#chat-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 92, 168, 0.1);
}

#chat-submit {
    align-self: flex-start;
    min-width: 120px;
    cursor: pointer;
}

#chat-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

.chat-error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #f87171;
    font-size: 0.95rem;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--accent);
}

.response-title {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.response-section {
    margin-bottom: 2rem;
}

.response-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.response-text {
    line-height: 1.8;
    color: var(--text-main);
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
}

.response-details {
    margin-bottom: 2rem;
    background: white;
    border: 1px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
}

.response-details summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    cursor: pointer;
    background: rgba(33, 92, 168, 0.05);
    user-select: none;
    transition: var(--transition);
}

.response-details summary:hover {
    background: rgba(33, 92, 168, 0.1);
}

.response-text-block {
    padding: 1.5rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-wrap;
}

.debug-details pre {
    padding: 1.5rem;
    background: #f8fafc;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 0;
}

.route-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.route-tag {
    background: rgba(33, 92, 168, 0.1);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.route-tag.neutral {
    background: #f1f5f9;
    color: var(--text-muted);
}

.evidence-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.evidence-item {
    background: white;
    padding: 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
    border-left: 4px solid var(--primary-light);
}

.evidence-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.evidence-text {
    font-size: 0.95rem;
    line-height: 1.6;
}

.reference-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.reference-link:hover {
    text-decoration: underline;
}

/* Spinner Animation */
.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ==========================================================================
   New Results & Discussion Components
   ========================================================================== */

/* Math Block Styles */
.math-block {
    background-color: rgba(33, 92, 168, 0.03);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    color: var(--primary-dark);
    overflow-x: auto;
}

.math-title {
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.math-formula {
    font-family: 'Outfit', 'Inter', monospace;
    font-weight: 600;
    text-align: center;
    padding: 0.5rem 0;
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
    box-shadow: var(--shadow-sm);
    background: #ffffff;
}

/* Premium Table Styles */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.results-table th {
    background-color: var(--bg-alt);
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--accent);
}

.results-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--accent);
    color: var(--text-muted);
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr:hover {
    background-color: rgba(33, 92, 168, 0.02);
}

/* Highlight Best Performance */
.best-val {
    font-weight: 700;
    color: var(--primary);
    background-color: rgba(33, 92, 168, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* Table Headers with Sub-columns */
.results-table th.center, .results-table td.center {
    text-align: center;
}

/* Tab Component for Dynamics */
.tabs-container {
    margin-top: 1.5rem;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--accent);
}

.tabs-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 0.75rem;
}

.tab-btn {
    background: var(--bg-alt);
    border: 1px solid var(--accent);
    color: var(--text-muted);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.tab-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(33, 92, 168, 0.25);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

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

/* FAQ/Takeaways Cards */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

@media (max-width: 768px) {
    .faq-grid {
        grid-template-columns: 1fr;
    }
}

.faq-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--accent);
    transition: var(--transition);
    border-top: 4px solid var(--primary-light);
}

.faq-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.faq-question {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faq-question::before {
    content: '?';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: rgba(33, 92, 168, 0.1);
    color: var(--primary);
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 800;
}

.faq-answer {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}
