/* ═══════════════════════════════════════════════════════════════
   WRIGHTFORGE LAB — Exploration & Experimentation Theme
   Bridged with Midnight Steel design system
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   CSS Variables
   ───────────────────────────────────────────────────────────────── */
:root {
    /* Core Colors — aligned with Midnight Steel */
    --bg-primary: #111318;
    --bg-secondary: #161920;
    --bg-tertiary: #1A1D25;
    --bg-card: #161920;

    /* Accent Colors — teal as lab signature */
    --accent: #4ECDC4;
    --accent-light: #6ED9D2;
    --accent-amber: #E0A848;
    --accent-blue: #6B9BCC;

    /* Status Colors */
    --status-live: var(--accent);
    --status-wip: var(--accent-amber);
    --status-concept: var(--accent-blue);

    /* Text Colors — matched to main site */
    --text-primary: #E8E6E1;
    --text-secondary: #7A7D85;
    --text-muted: #555860;
    --text-bright: #ffffff;

    /* Borders & Lines — matched to main site */
    --border: #2A2D35;
    --border-accent: rgba(78, 205, 196, 0.3);

    /* Typography — Syne body (main site), JetBrains Mono for code */
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-body: 'Syne', -apple-system, sans-serif;

    /* Spacing */
    --section-padding: 80px;
    --content-width: 1100px;

    /* Animation — matched to main site */
    --ease-primary: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─────────────────────────────────────────────────────────────────
   Reset & Base
   ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────────
   Subtle Grid Background
   ───────────────────────────────────────────────────────────────── */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
    background-image:
        linear-gradient(rgba(78, 205, 196, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(78, 205, 196, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
}

.gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(78, 205, 196, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 0% 100%, rgba(107, 155, 204, 0.03) 0%, transparent 40%);
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────
   Header / Navigation
   ───────────────────────────────────────────────────────────────── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(17, 19, 24, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0;
    font-family: var(--font-mono);
    font-size: 14px;
}

.logo-bracket {
    color: var(--text-muted);
}

.logo-text {
    color: var(--text-secondary);
}

.logo-slash {
    color: var(--text-muted);
    margin: 0 2px;
}

.logo-lab {
    color: var(--accent);
}

.nav {
    display: flex;
    gap: 4px;
}

.nav a {
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.3s var(--ease-primary);
}

.nav a:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: rgba(78, 205, 196, 0.05);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(78, 205, 196, 0.05);
    border: 1px solid var(--border-accent);
}

.status-led {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: ledPulse 2s ease-in-out infinite;
}

@keyframes ledPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────
   Hero Section - Terminal Window
   ───────────────────────────────────────────────────────────────── */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120px 40px 80px;
}

.terminal-window {
    width: 100%;
    max-width: 700px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 40px;
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27ca40; }

.terminal-title {
    margin-left: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.terminal-body {
    padding: 24px;
    font-family: var(--font-mono);
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.prompt {
    color: var(--accent);
}

.command {
    color: var(--text-primary);
}

.terminal-output {
    padding: 16px 0 24px 24px;
}

.output-main {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.output-sub {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-secondary);
}

.terminal-stats {
    display: flex;
    gap: 24px;
    padding: 12px 0 24px 24px;
}

.stat {
    font-size: 13px;
    color: var(--text-primary);
}

.stat-label {
    color: var(--accent-amber);
}

.cursor-line {
    margin-top: 8px;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--accent);
    animation: cursorBlink 1s step-end infinite;
}

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

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--bg-primary);
    background: var(--accent);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s var(--ease-primary);
}

.hero-cta:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.hero-cta svg {
    animation: bounceDown 2s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* ─────────────────────────────────────────────────────────────────
   Projects Section
   ───────────────────────────────────────────────────────────────── */
.projects-section {
    padding: var(--section-padding) 40px;
    max-width: var(--content-width);
    margin: 0 auto;
}

.section-header {
    margin-bottom: 32px;
}

.section-tag {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-muted);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.project-card {
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--ease-primary);
}

.project-card:hover {
    border-color: var(--border-accent);
    background: rgba(78, 205, 196, 0.03);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.project-status {
    font-family: var(--font-mono);
    padding: 2px 8px;
    font-size: 9px;
    letter-spacing: 1px;
    border: 1px solid;
    border-radius: 3px;
}

.project-status.live {
    color: var(--status-live);
    border-color: var(--status-live);
    background: rgba(78, 205, 196, 0.1);
}

.project-status.wip {
    color: var(--status-wip);
    border-color: var(--status-wip);
    background: rgba(224, 168, 72, 0.1);
}

.project-status.concept {
    color: var(--status-concept);
    border-color: var(--status-concept);
    background: rgba(107, 155, 204, 0.1);
}

.project-name {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.project-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.project-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tech-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 3px;
}

/* ─────────────────────────────────────────────────────────────────
   Log Section
   ───────────────────────────────────────────────────────────────── */
.log-section {
    padding: var(--section-padding) 40px;
    max-width: var(--content-width);
    margin: 0 auto;
}

.log-entries {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    overflow: hidden;
}

.log-entry {
    display: flex;
    gap: 20px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.3s var(--ease-primary);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry:hover {
    background: rgba(78, 205, 196, 0.03);
}

.log-date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    flex-shrink: 0;
    width: 90px;
}

.log-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────────── */
.site-footer {
    padding: 40px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.footer-content {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-prompt {
    font-family: var(--font-mono);
    color: var(--accent);
}

.footer-text {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 13px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s var(--ease-primary);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-right {
    font-size: 12px;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────
   Responsive Design
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 60px;
    }

    .site-header {
        padding: 12px 20px;
    }

    .nav {
        display: none;
    }

    .header-status {
        display: none;
    }

    .hero {
        padding: 100px 20px 60px;
    }

    .terminal-window {
        max-width: 100%;
    }

    .output-main {
        font-size: 24px;
    }

    .terminal-stats {
        flex-direction: column;
        gap: 8px;
    }

    .projects-section,
    .log-section {
        padding: var(--section-padding) 20px;
    }

    .log-entry {
        flex-direction: column;
        gap: 4px;
    }

    .log-date {
        width: auto;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer-links {
        gap: 16px;
    }
}

/* ─────────────────────────────────────────────────────────────────
   Utility Classes
   ───────────────────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

/* ═══════════════════════════════════════════════════════════════
   AI CHAT — TERMINAL STYLE
   ═══════════════════════════════════════════════════════════════ */

.chat-section {
    padding: var(--section-padding) 40px;
    max-width: var(--content-width);
    margin: 0 auto;
}

.chat-terminal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

/* Terminal header — reuses existing .terminal-header styles */
.chat-terminal .terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.chat-terminal-actions {
    margin-left: auto;
}

.chat-action-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s var(--ease-primary);
}

.chat-action-btn:hover {
    color: var(--accent);
    border-color: var(--border-accent);
}

/* Terminal body — scrollable message area */
.chat-terminal-body {
    height: 320px;
    overflow-y: auto;
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Boot / welcome lines */
.chat-boot {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.term-muted {
    color: var(--text-muted);
    font-size: 12px;
}

/* Message lines */
.chat-line {
    margin-bottom: 4px;
    animation: fadeIn 0.2s ease;
}

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

.chat-line.user-line {
    color: var(--accent);
}

.chat-line.user-line::before {
    content: '$ ask > ';
    color: var(--text-muted);
}

.chat-line.response-line {
    color: var(--text-primary);
    padding-left: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
}

.chat-line.response-line a {
    color: var(--accent);
}

.chat-line.response-line code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.chat-line.response-line strong {
    color: var(--text-bright);
}

.chat-line.error-line {
    color: var(--accent-amber);
    padding-left: 16px;
    font-size: 12px;
}

/* Typing indicator */
.chat-line.typing-line {
    color: var(--text-muted);
    padding-left: 16px;
}

.chat-line.typing-line::after {
    content: '...';
    animation: dots 1.4s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

/* Command suggestions */
.chat-commands {
    padding: 0 24px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cmd-chip {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s var(--ease-primary);
}

.cmd-chip::before {
    content: '$ ';
    color: var(--accent);
}

.cmd-chip:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: rgba(78, 205, 196, 0.05);
}

/* Prompt input line */
.chat-prompt-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
}

.chat-prompt-symbol {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 14px;
    flex-shrink: 0;
}

.chat-prompt-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
}

.chat-prompt-input::placeholder {
    color: var(--text-muted);
}

.chat-prompt-send {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 14px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease-primary);
}

.chat-prompt-send:hover {
    color: var(--accent);
    border-color: var(--border-accent);
}

.chat-prompt-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Rate limit warning */
.rate-limit-warning {
    color: var(--accent-amber);
    padding-left: 16px;
    font-size: 12px;
    margin: 4px 0;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .chat-section {
        padding: 3rem 1rem;
    }

    .chat-terminal-body {
        height: 280px;
        padding: 16px;
    }

    .chat-commands {
        padding: 0 16px 12px;
    }

    .chat-prompt-line {
        padding: 12px 16px 16px;
    }

    .cmd-chip {
        font-size: 10px;
    }
}
