/* =========================================================================
   Boowm — minimal futuristic design system
   ========================================================================= */

:root {
    --bg:        #0e1316;
    --bg-soft:   #111619;
    --fg:        #f5f6f7;
    --fg-mute:   rgba(245, 246, 247, 0.58);
    --fg-faint:  rgba(245, 246, 247, 0.30);
    --fg-ghost:  rgba(245, 246, 247, 0.14);
    --rule:      rgba(255, 255, 255, 0.06);
    --rule-hi:   rgba(255, 255, 255, 0.12);
    --accent:    #e8723a;
    --accent-hi: #f59264;
}

html, body {
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-feature-settings: "ss01", "cv11", "kern";
}

/* =========================================================================
   Typography — display, label, spec
   ========================================================================= */

.font-display {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 0.98;
}

.font-display-tight {
    letter-spacing: -0.035em;
    line-height: 0.92;
}

.font-mono {
    font-family: ui-monospace, 'JetBrains Mono', 'DM Sans', monospace;
    font-feature-settings: "tnum", "zero";
}

.label {
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--fg-faint);
}

.label-accent {
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--accent);
}

.spec-index {
    font-family: ui-monospace, 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--fg-faint);
    font-feature-settings: "tnum";
}

/* Display sizes */
.display-xl { font-size: clamp(3rem, 9vw, 7.5rem); }
.display-lg { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.display-md { font-size: clamp(1.875rem, 4vw, 2.75rem); }

/* =========================================================================
   Layout primitives — hairlines, grid, shell
   ========================================================================= */

.rule        { border-color: var(--rule); }
.rule-hi     { border-color: var(--rule-hi); }
.rule-top    { border-top: 1px solid var(--rule); }
.rule-bottom { border-bottom: 1px solid var(--rule); }
.rule-left   { border-left: 1px solid var(--rule); }

.grid-overlay {
    background-image:
        linear-gradient(var(--rule) 1px, transparent 1px),
        linear-gradient(90deg, var(--rule) 1px, transparent 1px);
    background-size: 96px 96px;
}

.vignette::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 0%,
                rgba(232, 114, 58, 0.04),
                transparent 60%);
}

/* =========================================================================
   Motion — restrained, purposeful
   ========================================================================= */

@keyframes fadeIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp    { from { opacity: 0; transform: translateY(12px); }
                         to   { opacity: 1; transform: translateY(0); } }
@keyframes pulseDot    { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes scan        { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.animate-fade-in      { animation: fadeIn 0.6s ease-out forwards; }
.animate-fade-in-up   { animation: fadeInUp 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.animate-on-load      { opacity: 0; }

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

.pulse-dot {
    position: relative;
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulseDot 2.4s ease-in-out infinite;
}
.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0.25;
}

.transition-smooth { transition: color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* =========================================================================
   Scroll-triggered reveal — visible by default; hide + animate only when
   the JS observer is alive. We add `.has-reveal` to <html> from RevealInit
   only after we have successfully installed the observer. If WASM fails,
   the observer never installs, the class is never added, and content stays
   visible — never blank.
   ========================================================================= */

html.has-reveal [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
                transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: opacity, transform;
}
html.has-reveal [data-reveal="fade"] { transform: none; }
html.has-reveal [data-reveal="left"] { transform: translateX(-20px); }
html.has-reveal [data-reveal="right"] { transform: translateX(20px); }
html.has-reveal [data-reveal="scale"] { transform: scale(0.98); }

html.has-reveal [data-reveal][data-visible="1"] {
    opacity: 1;
    transform: none;
}

/* Staggered delays for grouped children */
html.has-reveal [data-reveal-delay="1"] { transition-delay: 80ms; }
html.has-reveal [data-reveal-delay="2"] { transition-delay: 160ms; }
html.has-reveal [data-reveal-delay="3"] { transition-delay: 240ms; }
html.has-reveal [data-reveal-delay="4"] { transition-delay: 320ms; }
html.has-reveal [data-reveal-delay="5"] { transition-delay: 400ms; }
html.has-reveal [data-reveal-delay="6"] { transition-delay: 480ms; }

/* Reduce-motion preference: never animate, always show. */
@media (prefers-reduced-motion: reduce) {
    html.has-reveal [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* =========================================================================
   Active nav — underline the current page
   ========================================================================= */

.nav-item {
    position: relative;
    padding-bottom: 4px;
    transition: color 0.25s ease;
}
.nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--accent);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.nav-item:hover { color: var(--accent); }
.nav-item:hover::after { transform: scaleX(0.35); }
.nav-item.is-current { color: var(--fg); }
.nav-item.is-current::after { transform: scaleX(1); }

/* =========================================================================
   Extra microinteractions
   ========================================================================= */

/* Subtle scan sweep across primary CTA on hover */
.btn-primary {
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%,
                rgba(255,255,255,0.25) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    pointer-events: none;
}
.btn-primary:hover::before { transform: translateX(120%); }

/* Work-row accent tick: a small chevron that slides in on hover */
.work-row-chevron {
    display: inline-block;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.work-row:hover .work-row-chevron {
    opacity: 1;
    transform: translateX(0);
}
.work-row:hover .work-row-name {
    color: var(--accent);
}

/* Subtle breathing glow on hero accent words */
@keyframes accentBreathe {
    0%, 100% { text-shadow: 0 0 0 rgba(232,114,58,0); }
    50%      { text-shadow: 0 0 22px rgba(232,114,58,0.25); }
}
.accent-breathe { animation: accentBreathe 5s ease-in-out infinite; }

/* Pulse spread — ripple around the status dot */
@keyframes pulseRing {
    0%   { transform: scale(0.6); opacity: 0.6; }
    100% { transform: scale(2.4); opacity: 0; }
}
.pulse-dot::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.5;
    animation: pulseRing 2.4s ease-out infinite;
}

/* Link underline — confident, precise */
.link-accent {
    color: var(--fg);
    position: relative;
    padding-bottom: 2px;
}
.link-accent::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0.4);
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.link-accent:hover { color: var(--accent); }
.link-accent:hover::after { transform: scaleX(1); }

/* =========================================================================
   Isometric hero — minimal signature scene
   ========================================================================= */

.iso-stage {
    perspective: 1400px;
    perspective-origin: 50% 40%;
}

.iso-plane {
    transform: rotateX(58deg) rotateZ(-45deg);
    transform-style: preserve-3d;
}

@keyframes isoBob {
    0%, 100% { transform: translateZ(0); }
    50%      { transform: translateZ(4px); }
}

@keyframes isoDrift {
    0%   { transform: translate3d(0, 0, 0); }
    25%  { transform: translate3d(32px, 0, 0); }
    50%  { transform: translate3d(32px, 32px, 0); }
    75%  { transform: translate3d(0, 32px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.iso-agent-bob  { animation: isoBob 3.2s ease-in-out infinite; transform-origin: center bottom; transform-box: fill-box; }
.iso-agent-drift { animation: isoDrift 16s linear infinite; }

/* Zone ring — slow pulsing highlight under active agents */
@keyframes isoZonePulse {
    0%, 100% { opacity: 0.12; }
    50%      { opacity: 0.28; }
}
.iso-zone-pulse { animation: isoZonePulse 3.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }

/* Status dot pulses — staggered per stage */
@keyframes isoStatus {
    0%, 100% { opacity: 0.35; r: 2.5; }
    50%      { opacity: 1;    r: 3.2; }
}
.iso-status { animation: isoStatus 2.2s ease-in-out infinite; }

/* Human review gate — slower, amber, more deliberate */
@keyframes isoHumanRing {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50%      { opacity: 0.6;  transform: scale(1.08); }
}
.iso-human-ring { animation: isoHumanRing 3.2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }

/* Inbox stack — gentle stagger */
@keyframes isoInboxFade {
    0%, 90%, 100% { opacity: 1; }
    45%           { opacity: 0.5; }
}
.iso-inbox-top { animation: isoInboxFade 4s ease-in-out infinite; }

/* =========================================================================
   Button — flat, precise
   ========================================================================= */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.4rem;
    background: var(--accent);
    color: #0b0e10;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--accent);
    transition: background 0.25s ease, transform 0.25s ease;
}
.btn-primary:hover { background: var(--accent-hi); transform: translateY(-1px); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.4rem;
    background: transparent;
    color: var(--fg);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid var(--rule-hi);
    transition: border-color 0.25s ease, color 0.25s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================================
   Chat — unchanged styling, carried from previous build
   ========================================================================= */

.chat-markdown p { margin-bottom: 0.5em; }
.chat-markdown p:last-child { margin-bottom: 0; }
.chat-markdown strong { color: rgba(255,255,255,0.95); font-weight: 600; }
.chat-markdown em { color: rgba(255,255,255,0.85); font-style: italic; }
.chat-markdown a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-markdown a:hover { color: var(--accent-hi); }
.chat-markdown code {
    font-family: ui-monospace, monospace;
    font-size: 0.85em;
    background: rgba(255,255,255,0.06);
    padding: 0.15em 0.4em;
    border-radius: 2px;
    color: var(--accent-hi);
}
.chat-markdown pre {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--rule);
    padding: 0.75em 1em;
    margin: 0.5em 0;
    overflow-x: auto;
    font-size: 0.85em;
}
.chat-markdown pre code { background: none; padding: 0; color: rgba(255,255,255,0.85); }
.chat-markdown ul, .chat-markdown ol { padding-left: 1.5em; margin: 0.4em 0; }
.chat-markdown li { margin-bottom: 0.2em; }
.chat-markdown ul li { list-style-type: disc; }
.chat-markdown ol li { list-style-type: decimal; }
.chat-markdown h1, .chat-markdown h2, .chat-markdown h3 {
    color: rgba(255,255,255,0.95);
    font-weight: 600;
    margin: 0.6em 0 0.3em;
}
.chat-markdown h1 { font-size: 1.2em; }
.chat-markdown h2 { font-size: 1.1em; }
.chat-markdown h3 { font-size: 1em; }
.chat-markdown blockquote {
    border-left: 2px solid rgba(232,114,58,0.4);
    padding-left: 0.75em;
    margin: 0.5em 0;
    color: rgba(255,255,255,0.6);
}
.chat-markdown hr { border-color: var(--rule); margin: 0.75em 0; }
.chat-markdown table { border-collapse: collapse; margin: 0.5em 0; width: 100%; }
.chat-markdown th, .chat-markdown td {
    border: 1px solid var(--rule-hi);
    padding: 0.3em 0.6em;
    text-align: left;
    font-size: 0.9em;
}
.chat-markdown th { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.9); }

.chat-scroll::-webkit-scrollbar { width: 4px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-scroll::-webkit-scrollbar-thumb { background: rgba(232,114,58,0.2); border-radius: 2px; }
.chat-scroll::-webkit-scrollbar-thumb:hover { background: rgba(232,114,58,0.4); }

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-4px); }
}
.typing-dot { animation: typingDot 1.4s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes toolSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.tool-spin { animation: toolSpin 1.5s linear infinite; }
