/*
 * Brain OS — Base stylesheet
 * CSS variables (design tokens) + minimal reset + placeholder styles.
 * Full design system applied in Phase 9.
 */

/* ── Design tokens (Section 8) ─────────────────────────────────────────────── */

:root {
    /* Backgrounds */
    --color-bg:       #0D0F14;
    --color-surface:  #161B25;
    --color-border:   #252D3D;

    /* Text */
    --color-text:       #E8EAF0;
    --color-text-muted: #6B7280;

    /* Accent / status */
    --color-accent:  #4AEDB4;
    --color-warning: #FF6B6B;
    --color-success: #4AED88;

    /* Node types */
    --color-node-project:  #4AEDB4;
    --color-node-goal:     #F5C842;
    --color-node-idea:     #A78BFA;
    --color-node-task:     #60A5FA;
    --color-node-resource: #94A3B8;

    /* Typography */
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-ui:      'DM Mono', 'Courier New', monospace;
    --font-body:    'Lora', Georgia, serif;

    /* Spacing scale */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  40px;
    --space-2xl: 64px;

    /* Motion */
    --transition-fast: 100ms ease;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */

/* Ensure [hidden] always wins over display: flex / grid / block in author CSS */
[hidden] { display: none !important; }

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

html, body {
    height: 100%;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--font-ui);
    font-size: 0.875em;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ── Placeholder styles (removed in Phase 9) ────────────────────────────────── */

.brain-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: var(--space-md);
    text-align: center;
    padding: var(--space-xl);
}

.brain-placeholder h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--color-accent);
}

.brain-placeholder__label {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 3px;
}

.brain-placeholder p {
    color: var(--color-text-muted);
    max-width: 400px;
}

.brain-placeholder__nav {
    display: flex;
    gap: var(--space-lg);
    margin-top: var(--space-md);
    font-family: var(--font-ui);
    font-size: 0.875rem;
}

/* ── Global polish (Phase 9) ────────────────────────────────────────────────── */

html {
    scroll-behavior: smooth;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* Selection */
::selection {
    background: rgba(74, 237, 180, 0.25);
    color: var(--color-text);
}

/* Keyboard focus ring — only for keyboard users */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}
*:focus:not(:focus-visible) { outline: none; }

/* ── Global nav search ──────────────────────────────────────────────────────── */

.nav-search {
    position: relative;
    flex: 0 1 240px;
    min-width: 0;
}

.nav-search__input {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 5px 10px;
    outline: none;
    transition: border-color 0.15s;
}
.nav-search__input:focus {
    border-color: var(--color-accent);
}
.nav-search__input::placeholder {
    color: var(--color-text-muted);
}
/* hide browser clear button — we handle close ourselves */
.nav-search__input::-webkit-search-cancel-button { display: none; }

.nav-search__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 280px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 9999;
}

.ns-group { padding: 6px 0; }
.ns-group + .ns-group { border-top: 1px solid var(--color-border); }

.ns-group__label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 12px 2px;
}

.ns-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 12px;
    text-decoration: none;
    transition: background 0.1s;
}
.ns-item:hover { background: rgba(255,255,255,0.05); }

.ns-item__title {
    font-size: 0.85rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ns-item__meta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ns-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--color-border);
    color: var(--color-text-muted);
    white-space: nowrap;
}
.ns-badge--blocked { background: rgba(255,107,107,0.2); color: var(--color-warning); }
.ns-badge--paused  { background: rgba(107,114,128,0.2); }
.ns-badge--someday { background: rgba(107,114,128,0.15); }
.ns-badge--done    { background: rgba(74,237,136,0.15); color: var(--color-success); }

.ns-empty {
    padding: 14px 12px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
}

@media (max-width: 600px) {
    .nav-search {
        display: none;
    }
}
