/* NEO-BRUTALISM THEME */
:root {
    --bg-main: #f0f0f0;
    --border-color: #000000;
    --border-width: 3px;
    --shadow-offset: 5px;
    --shadow-color: #000000;
    
    /* Neo-brutalist Colors */
    --neo-yellow: #fdfd96;
    --neo-pink: #ffb3b3;
    --neo-cyan: #a0e6ff;
    --neo-green: #bbf7d0;
    --neo-red: #ff8b8b;
    --neo-purple: #d8b4fe;
    --neo-white: #ffffff;
    --neo-dark: #12141d;
    
    --text-main: #000000;
    --text-muted: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    color: var(--text-main);
}

body {
    background-color: var(--bg-main);
    background-image: radial-gradient(#d0d0d0 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

/* Base Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

/* Neo-brutalist Card */
.neo-card, .neo-header, .neo-nav {
    background-color: var(--neo-white);
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--shadow-color);
    padding: 1.5rem;
    border-radius: 0; /* Hard edges */
    margin-bottom: 2rem;
}

/* Nav */
.neo-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--neo-yellow);
}
.logo { font-weight: 700; font-size: 1.2rem; }
.logo span { background: var(--neo-pink); padding: 0 5px; border: 2px solid #000; }
.nav-link { text-decoration: none; font-weight: 700; border-bottom: 2px solid #000; }

.neo-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header / Hero */
.neo-header {
    text-align: center;
    background-color: var(--neo-cyan);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 2rem;
}
.neo-header h1 { font-size: 3rem; background: #fff; padding: 0 10px; border: 3px solid #000; display: inline-block; box-shadow: 4px 4px 0 #000; }
.neo-header p { font-size: 1.1rem; max-width: 600px; font-weight: 500; background: #fff; padding: 10px; border: 2px solid #000; }

/* Badges */
.neo-badge {
    background: var(--neo-yellow);
    border: 2px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 2px 2px 0 var(--border-color);
    display: inline-block;
    text-transform: uppercase;
}
.neo-badge.outline { background: var(--neo-white); }
.neo-badge.filled { background: var(--neo-pink); }
.neo-badge.green { background: var(--neo-green); }
.neo-badge.red { background: var(--neo-red); }

/* Buttons */
.neo-btn {
    background: var(--neo-white);
    border: var(--border-width) solid var(--border-color);
    box-shadow: 4px 4px 0 var(--border-color);
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.neo-btn.primary { background: var(--neo-pink); }
.neo-btn.small { padding: 0.4rem 0.8rem; font-size: 0.85rem; box-shadow: 2px 2px 0 var(--border-color); }
.neo-btn.huge-btn { font-size: 1.2rem; padding: 1rem 2rem; box-shadow: 6px 6px 0 var(--border-color); }
.neo-btn.icon-btn { padding: 0.5rem 1rem; background: var(--neo-cyan); font-size: 1.2rem; line-height: 1; }
.neo-btn.full-width { width: 100%; }

.neo-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0 var(--border-color);
}
.neo-btn.small:active { transform: translate(2px, 2px); box-shadow: 0 0 0 #000; }
.neo-btn.huge-btn:active { transform: translate(6px, 6px); }
.neo-btn.active { background: var(--neo-yellow); }

/* Forms & Inputs */
.neo-textarea, .neo-select {
    width: 100%;
    background: var(--neo-white);
    border: var(--border-width) solid var(--border-color);
    box-shadow: 4px 4px 0 var(--border-color);
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
    transition: background 0.2s;
}
.neo-textarea:focus { background: #fffbe6; }
.neo-select { cursor: pointer; padding: 0.7rem; }

/* Grid Layout (App Page) */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.span-full { grid-column: 1 / -1; }
@media (max-width: 900px) {
    .grid-layout { grid-template-columns: 1fr; }
}

/* Sections & Tabs */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    border: 3px solid #000;
    box-shadow: 4px 4px 0 var(--neo-cyan);
}
.section-title h2 { color: #fff; margin: 0; }

.provider-tabs, .timeline-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}
.neo-tab {
    background: var(--neo-white);
    border: 3px solid #000;
    padding: 0.5rem 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
}
.neo-tab.active { background: var(--neo-green); transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }

/* Carousel Specific */
.step-tracker {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    font-weight: 700;
    flex-wrap: wrap;
}
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #e5e5e5;
    padding: 1.5rem;
    border: 3px solid #000;
    box-shadow: inset 4px 4px 0 #ccc;
    margin-bottom: 1.5rem;
}
.chat-bubble {
    display: flex;
    gap: 1rem;
}
.chat-bubble .avatar {
    width: 40px; height: 40px; border: 3px solid #000; background: var(--neo-yellow);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
    box-shadow: 2px 2px 0 #000; flex-shrink: 0;
}
.chat-bubble .avatar.out { background: var(--neo-pink); }
.bubble-body {
    background: #fff; border: 3px solid #000; padding: 1rem; flex: 1;
    box-shadow: 3px 3px 0 #000;
}
.status-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }

/* Math Box & Formulas Fix */
.math-box {
    background: var(--neo-yellow);
    border: 3px solid #000;
    padding: 1.5rem;
    box-shadow: 4px 4px 0 #000;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.math-header {
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: #000;
    color: var(--neo-yellow);
    display: inline-block;
    padding: 0.2rem 0.6rem;
    width: max-content;
    border: 2px solid #000;
}

.formula-container {
    background: #ffffff;
    border: 3px solid #000;
    padding: 1.25rem;
    box-shadow: 3px 3px 0 #000;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
}

.formula {
    font-size: 1.2rem;
    font-weight: 700;
    width: 100%;
    text-align: center;
    color: #000;
}

.formula mjx-container {
    font-size: 115% !important;
    margin: 0.5em 0 !important;
    max-width: 100%;
    overflow-x: auto;
    display: inline-block;
}

.math-desc {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    background: #ffffff;
    border: 2px solid #000;
    padding: 0.8rem 1rem;
}

/* Auto Rationale Box */
.auto-rationale-box {
    background: var(--neo-purple);
    border: 3px solid #000;
    box-shadow: 3px 3px 0 #000;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auto-tag {
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: #000;
    color: var(--neo-purple);
    padding: 0.15rem 0.5rem;
    width: max-content;
    border: 1px solid #000;
}

.auto-text {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    color: #000;
}

.attack-status-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.rewrite-warning-box {
    background: var(--neo-yellow);
    border: 3px solid #000;
    box-shadow: 3px 3px 0 #000;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Diff Visualizer Neo */
.diff-view {
    background: var(--neo-white);
    border: var(--border-width) solid var(--border-color);
    box-shadow: 4px 4px 0 var(--border-color);
    padding: 1rem;
    min-height: 150px;
}
.diff-legend {
    display: flex; gap: 1rem; margin-bottom: 1rem; font-weight: 700; font-size: 0.85rem;
    border-bottom: 2px solid #000; padding-bottom: 0.5rem;
}
.legend-del { background: var(--neo-red); padding: 0 5px; border: 1px solid #000; }
.legend-add { background: var(--neo-green); padding: 0 5px; border: 1px solid #000; }

.diff-content {
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.8;
}
.diff-del {
    background: var(--neo-red);
    text-decoration: line-through;
    border: 2px solid #000;
    padding: 0 4px;
    margin: 0 2px;
    font-weight: 700;
}
.diff-add {
    background: var(--neo-green);
    border: 2px solid #000;
    padding: 0 4px;
    margin: 0 2px;
    font-weight: 700;
}

/* App Page Layout Elements */
.card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;
    border-bottom: 3px solid #000; padding-bottom: 0.5rem;
}
.controls {
    display: flex; gap: 1rem; margin: 1rem 0; align-items: center;
}
.control-group { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; font-weight: 700; }

.neo-checkbox-label {
    display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 700;
}
.neo-checkbox-label input { display: none; }
.neo-checkbox {
    width: 24px; height: 24px; background: #fff; border: 3px solid #000;
    box-shadow: 2px 2px 0 #000; display: flex; align-items: center; justify-content: center;
}
.neo-checkbox-label input:checked + .neo-checkbox { background: var(--neo-pink); }
.neo-checkbox-label input:checked + .neo-checkbox::after { content: 'X'; font-weight: 800; font-size: 1rem; }

.score-row {
    display: flex; gap: 1rem; margin: 1rem 0;
}
.score-box {
    flex: 1; background: var(--neo-cyan); border: 3px solid #000; padding: 1rem;
    box-shadow: 4px 4px 0 #000; display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.score-label { font-weight: 700; font-size: 0.8rem; background: #fff; border: 2px solid #000; padding: 0 5px; }
.score-val { font-size: 2rem; font-family: 'JetBrains Mono', monospace; font-weight: 700; background: #fff; border: 3px solid #000; padding: 0 10px; }

.neo-banner {
    background: #e5e5e5; border: 3px solid #000; padding: 1rem; font-weight: 700;
    text-align: center; box-shadow: 4px 4px 0 #000; margin-bottom: 1rem; text-transform: uppercase;
}
.neo-banner.green { background: var(--neo-green); }
.neo-banner.red { background: var(--neo-red); }
.neo-banner.yellow { background: var(--neo-yellow); }

.meta-footer {
    display: flex; justify-content: space-between; margin-top: 1rem; border-top: 3px solid #000; padding-top: 0.5rem;
}

/* Pipeline Logs Fix (High Contrast & Visible Text) */
.logs-container {
    background: var(--neo-dark);
    color: #ffffff;
    padding: 1.2rem;
    border: 3px solid #000;
    box-shadow: 4px 4px 0 var(--neo-pink);
    margin-top: 1.5rem;
}
.logs-container h4 {
    color: var(--neo-yellow);
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    letter-spacing: 1px;
}
.logs-container ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 180px;
    overflow-y: auto;
}
.logs-container li {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--neo-green);
    background: #1c202e;
    padding: 0.5rem 0.8rem;
    border: 1px solid #333;
}

.hidden { display: none !important; }

/* ==========================================
   METHOD ARTIFACTS SECTION
   ========================================== */
.neo-section { margin-bottom: 2.5rem; }

.section-lead {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    background: var(--neo-white);
    border: 2px solid #000;
    padding: 0.75rem 1rem;
    box-shadow: 3px 3px 0 #000;
}

/* ML portfolio story section */
.ml-story-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

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

.ml-story-card {
    padding: 1.25rem;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ml-story-card--wide {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ml-story-card--wide .neo-btn { margin-top: 0; }

.ml-story-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 0.75rem;
    color: #c45c00;
    letter-spacing: 0.08em;
}

.ml-story-card h3 {
    font-size: 1.1rem;
    margin: 0;
}

.ml-story-card p {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
}

.artifact-carousel {
    max-width: 100%;
}

.artifact-carousel .method-artifact {
    margin-bottom: 0;
}

.method-artifact {
    margin-bottom: 0;
    padding: 1.25rem;
    background: var(--neo-white);
}

.artifact-title {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    background: var(--neo-yellow);
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border: 2px solid #000;
    box-shadow: 2px 2px 0 #000;
}

.artifact-desc {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.artifact-demo {
    background: #fafafa;
    border: 3px solid #000;
    box-shadow: inset 0 0 0 1px #ddd, 4px 4px 0 #000;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.artifact-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed #000;
}

.artifact-header__left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.artifact-tag {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #c45c00;
    text-transform: uppercase;
}

.artifact-agent-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--neo-green);
    border: 2px solid #000;
    padding: 0.25rem 0.6rem;
    box-shadow: 2px 2px 0 #000;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c45c00;
    border: 1px solid #000;
    animation: statusBlink 1.2s ease-in-out infinite;
}

.artifact--playing .status-dot {
    animation: statusBlink 0.8s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.artifact-demo .chat-container { margin-bottom: 0; }
.artifact-user .bubble-body,
.artifact-agent .bubble-body {
    font-size: 0.88rem;
    line-height: 1.45;
}

/* Step progress stepper */
.step-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-progress__track {
    height: 6px;
    background: #e0e0e0;
    border: 2px solid #000;
    position: relative;
    overflow: hidden;
}

.step-progress__bar {
    height: 100%;
    width: 25%;
    background: #c45c00;
    transition: width 0.5s ease;
}

.step-progress__labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.step-progress__step {
    color: #888;
    transition: color 0.3s, transform 0.3s;
}

.step-progress__step--active {
    color: #c45c00;
    animation: stepPulse 1s ease infinite;
}

.step-progress__step--done {
    color: #000;
}

@keyframes stepPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* Dual info boxes */
.info-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 500px) {
    .info-boxes { grid-template-columns: 1fr; }
}

.info-box {
    background: var(--neo-white);
    border: 2px solid #000;
    padding: 0.75rem;
    box-shadow: 3px 3px 0 #000;
    font-size: 0.82rem;
}

.info-box__title {
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    color: #666;
}

.info-box__line {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}

.info-box__footer {
    margin-top: 0.5rem;
    font-weight: 800;
    font-size: 0.75rem;
    color: #c45c00;
    text-transform: uppercase;
}

/* Agent outcome animation */
.artifact-outcome--animate {
    animation: bubbleIn 0.45s ease forwards;
}

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

.artifact-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.25rem;
}

.artifact-chip {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: var(--neo-cyan);
    border: 2px solid #000;
    padding: 0.2rem 0.5rem;
    box-shadow: 2px 2px 0 #000;
}

@media (prefers-reduced-motion: reduce) {
    .status-dot,
    .step-progress__step--active,
    .artifact-outcome--animate {
        animation: none !important;
    }
    .step-progress__bar {
        transition: none;
    }
}
