/* ───────────────────────────────────────────
   Flx Lab — flxlab.dev
   Dark workshop / terminal-lab aesthetic
   ─────────────────────────────────────────── */

:root {
    --bg-deep: #09090b;
    --bg-surface: #111114;
    --bg-card: #16161a;
    --bg-elevated: #1c1c21;
    --border: #25252b;
    --border-subtle: #1e1e24;
    --text-primary: #e4e4e7;
    --text-secondary: #8b8b96;
    --text-muted: #55555e;
    --accent: #7c5cff;
    --accent-dim: #6344d9;
    --accent-glow: rgba(124, 92, 255, 0.15);
    --accent-glow-strong: rgba(124, 92, 255, 0.35);
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.15);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251, 191, 36, 0.15);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.15);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    --font-body: 'DM Sans', 'Segoe UI', sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --max-w: 860px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ── Noise overlay ── */
.noise {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ── Subtle grid background ── */
.grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image:
        linear-gradient(var(--text-muted) 1px, transparent 1px),
        linear-gradient(90deg, var(--text-muted) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ── Nav ── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 14px 24px;
}

.site-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: -1;
}

.nav-brand {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav-brand .accent {
    color: var(--accent);
}

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

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* ── Layout ── */
main {
    position: relative;
    z-index: 1;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ── Scroll animations ── */
.section-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    scroll-margin-top: 60px;
}

.section-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Hero ── */
.hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 60px 24px 40px;
    text-align: center;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow-strong) 0%, transparent 70%);
    filter: blur(80px);
    animation: glow-pulse 6s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -55%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -55%) scale(1.08); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid rgba(124, 92, 255, 0.2);
    border-radius: 20px;
    padding: 5px 14px;
    margin-bottom: 28px;
    animation: fade-in 0.6s ease both;
}

.hero-title {
    font-family: var(--font-mono);
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    animation: fade-in 0.6s ease 0.1s both;
}

.hero-title-flx {
    color: var(--text-primary);
}

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

.hero-tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.7;
    animation: fade-in 0.6s ease 0.2s both;
}

.hero-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 36px;
    animation: fade-in 0.6s ease 0.35s both;
}

.hero-divider span {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.hero-divider span:nth-child(2) {
    background: var(--accent);
    width: 20px;
    border-radius: 2px;
    height: 3px;
}

/* ── Sections ── */
.section-header {
    margin-bottom: 28px;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 6px;
}

.section-title {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ── Projects ── */
.projects {
    margin-bottom: 72px;
}

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

.project-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.project-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    overflow: hidden;
}

.project-card:hover {
    border-color: rgba(124, 92, 255, 0.3);
    box-shadow: 0 0 30px rgba(124, 92, 255, 0.06);
    transform: translateY(-2px);
}

.project-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.project-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--accent);
}

.project-tags {
    display: flex;
    gap: 6px;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.tag-type {
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}

.tag-released {
    color: var(--green);
    background: var(--green-dim);
}

.tag-wip {
    color: var(--yellow);
    background: var(--yellow-dim);
}

.project-name {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.project-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 14px;
}

.inline-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(124, 92, 255, 0.3);
    transition: border-color var(--transition);
}

.inline-link:hover {
    border-color: var(--accent);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 5px 0;
    transition: opacity var(--transition);
}

.project-link:hover {
    opacity: 0.75;
}

.project-link svg {
    transition: transform var(--transition);
}

.project-link:hover svg {
    transform: translate(2px, -2px);
}

.project-bar {
    position: absolute;
    bottom: 0;
    left: 24px;
    right: 24px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.project-card:hover .project-bar {
    opacity: 0.6;
}

/* ── Changelog / Activity ── */
.activity {
    margin-bottom: 72px;
}

.changelog {
    position: relative;
    padding-left: 20px;
}

.changelog::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--border);
    transform: translateX(-0.5px);
}

.changelog-entry {
    position: relative;
    padding-bottom: 24px;
}

.changelog-entry:last-child {
    padding-bottom: 0;
}

.changelog-dot {
    position: absolute;
    left: -20px;
    top: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid;
}

.changelog-dot.launch {
    border-color: var(--accent);
    background: var(--accent);
}

.changelog-dot.deploy {
    border-color: var(--green);
    background: var(--green);
}

.changelog-dot.update {
    border-color: var(--yellow);
    background: transparent;
}

.changelog-dot.fix {
    border-color: var(--text-muted);
    background: transparent;
}

.changelog-date {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.changelog-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.changelog-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Status Dashboard ── */
.status {
    margin-bottom: 40px;
}

/* Loading */
.status-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 32px 0;
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error */
.status-error {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--red);
    background: var(--red-dim);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
}

/* Overall banner */
.status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid;
}

.status-banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-banner.operational {
    color: var(--green);
    background: var(--green-dim);
    border-color: rgba(52, 211, 153, 0.15);
}

.status-banner.operational .status-banner-dot {
    background: var(--green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    animation: dot-pulse-green 2s ease-in-out infinite;
}

.status-banner.degraded {
    color: var(--yellow);
    background: var(--yellow-dim);
    border-color: rgba(251, 191, 36, 0.15);
}

.status-banner.degraded .status-banner-dot {
    background: var(--yellow);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
    animation: dot-pulse-yellow 2s ease-in-out infinite;
}

.status-banner.outage {
    color: var(--red);
    background: var(--red-dim);
    border-color: rgba(248, 113, 113, 0.15);
}

.status-banner.outage .status-banner-dot {
    background: var(--red);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
    animation: dot-pulse-red 1.5s ease-in-out infinite;
}

@keyframes dot-pulse-green {
    0%, 100% { box-shadow: 0 0 4px rgba(52, 211, 153, 0.3); }
    50% { box-shadow: 0 0 12px rgba(52, 211, 153, 0.7); }
}

@keyframes dot-pulse-yellow {
    0%, 100% { box-shadow: 0 0 4px rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 12px rgba(251, 191, 36, 0.7); }
}

@keyframes dot-pulse-red {
    0%, 100% { box-shadow: 0 0 4px rgba(248, 113, 113, 0.3); }
    50% { box-shadow: 0 0 12px rgba(248, 113, 113, 0.8); }
}

/* Timestamp */
.status-timestamp {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding-left: 2px;
}

/* Groups */
.status-group {
    margin-bottom: 20px;
}

.status-group-name {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 2px;
}

.status-group-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Endpoint rows */
.endpoint-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    transition: background var(--transition);
}

.endpoint-row:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.endpoint-row:hover {
    background: var(--bg-elevated);
}

.endpoint-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.endpoint-dot.up {
    background: var(--green);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.endpoint-dot.degraded {
    background: var(--yellow);
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.endpoint-dot.down {
    background: var(--red);
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

.endpoint-name {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
}

.endpoint-uptime {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 42px;
    text-align: right;
}

.endpoint-uptime.good { color: var(--green); }
.endpoint-uptime.warn { color: var(--yellow); }
.endpoint-uptime.bad { color: var(--red); }

.endpoint-history {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.history-bar {
    width: 4px;
    height: 18px;
    border-radius: 1px;
    flex-shrink: 0;
    transition: opacity var(--transition);
    position: relative;
    cursor: default;
}

.history-bar.pass {
    background: var(--green);
    opacity: 0.5;
}

.history-bar.fail {
    background: var(--red);
    opacity: 0.7;
}

.history-bar.empty {
    background: var(--border);
    opacity: 0.3;
}

.history-bar:not(.empty):hover {
    opacity: 1;
}

/* History bar tooltip */
.history-tooltip {
    position: fixed;
    z-index: 200;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 8px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.history-tooltip.show {
    opacity: 1;
}

.endpoint-latency {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 52px;
    text-align: right;
}

/* ── Footer ── */
.site-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 20px 24px 40px;
    border-top: 1px solid var(--border-subtle);
}

.footer-brand {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.footer-brand .accent {
    color: var(--accent);
}

.footer-link {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.footer-link:hover {
    color: var(--accent);
    border-color: rgba(124, 92, 255, 0.3);
    background: var(--accent-glow);
}

.footer-year {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Utilities ── */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .site-nav {
        padding: 12px 16px;
    }

    .hero {
        min-height: 42vh;
        padding: 40px 20px 32px;
    }

    .hero-title {
        font-size: 3rem;
    }

    main {
        padding: 0 16px 60px;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .project-card:last-child:nth-child(odd) {
        grid-column: auto;
    }

    .endpoint-row {
        gap: 8px;
        padding: 10px 12px;
    }

    .endpoint-history {
        display: none;
    }

    .endpoint-latency {
        min-width: 44px;
    }
}
