:root {
    --bg-base: #0b0f17;
    --bg-surface: #111726;
    --bg-surface-hover: #161e31;
    --border-subtle: #1f2a3f;
    --border-active: #38bdf8;
    --accent-blue: #38bdf8;
    --accent-blue-dim: rgba(56, 189, 248, 0.12);
    --accent-green: #34d399;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#bg-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Status Bar */
.top-status-bar {
    background-color: rgba(11, 15, 23, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 6px 0;
}

.status-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    width: 8px; height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.audio-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.audio-btn.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Navbar */
.navbar {
    background: rgba(11, 15, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 90;
    padding: 14px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-avatar {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-blue);
}

.brand-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.brand-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover { color: #fff; }

.nav-btn {
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.nav-btn-outline {
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.nav-btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.nav-btn-primary {
    background-color: var(--accent-blue);
    color: #0b0f17;
    font-weight: 600;
}

.nav-btn-primary:hover {
    filter: brightness(1.1);
}

/* Hero Section */
.hero-section {
    padding: 75px 0 55px;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-blue);
    background: var(--accent-blue-dim);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 24px;
}

.hero-headline {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    line-height: 1.18;
    max-width: 920px;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.hero-subline {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 780px;
    line-height: 1.7;
    margin-bottom: 32px;
}

.hero-cta-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #0b0f17;
    font-weight: 600;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-blue);
    color: #fff;
    transform: translateY(-1px);
}

.btn-ghost {
    color: var(--text-secondary);
    background: transparent;
    border-color: var(--border-subtle);
}

.btn-ghost:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Section Common */
.projects-section, .skills-section {
    padding: 60px 0;
    border-top: 1px solid var(--border-subtle);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Filters */
.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--accent-blue-dim);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.project-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
}

.project-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5);
}

.card-badges {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.badge-accent {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.badge-meta {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.badge-mono {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tech-stack-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.tech-stack-row span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background-color: #0b0f17;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 4px;
}

.card-actions {
    display: flex;
    gap: 10px;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.skill-category-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.category-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.skills-list {
    list-style: none;
}

.skills-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    gap: 10px;
}

.skills-list li:last-child {
    border-bottom: none;
}

.skills-list li i {
    width: 16px;
    text-align: center;
    color: var(--accent-blue);
}

/* Testbench Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(5, 8, 14, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background-color: #0d1320;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    max-width: 680px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.modal-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent-blue);
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 600;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover { color: #fff; }

.modal-intro {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-intro code {
    font-family: var(--font-mono);
    background-color: #080c14;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-blue);
}

.testbench-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.terminal-node {
    background-color: #070a10;
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    text-align: center;
    width: 180px;
}

.node-title { font-weight: 600; font-size: 0.85rem; }
.node-sub { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }

.packet-lane {
    flex: 1;
    height: 2px;
    background-color: var(--border-subtle);
    position: relative;
}

.packet-carrier {
    position: absolute;
    top: -10px;
    left: 0;
    transition: left 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.packet-payload {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    background-color: var(--accent-blue);
    color: #0b0f17;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.calculator-panel {
    background-color: #070a10;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    font-size: 0.84rem;
}

.calc-top-row {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.calc-top-row code {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.calc-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.calc-controls input[type="range"] {
    accent-color: var(--accent-blue);
}

.calc-result {
    font-weight: 600;
}

.highlight-val {
    color: var(--accent-blue);
    font-family: var(--font-mono);
}

.testbench-console {
    background-color: #04060a;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    height: 80px;
    overflow-y: auto;
    margin-bottom: 18px;
}

.console-line.info { color: var(--text-secondary); }
.console-line.tx { color: var(--accent-blue); }
.console-line.rx { color: var(--accent-green); }

.testbench-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 28px 0;
    margin-top: 40px;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 768px) {
    .nav-links .nav-link { display: none; }
    .status-right .status-item { display: none; }
    .hero-headline { font-size: 2.2rem; }
    .testbench-stage { flex-direction: column; gap: 16px; }
    .packet-lane { width: 100%; height: 2px; }
    .terminal-node { width: 100%; }
}
