/* ============================================
   Robot Arm IK Portfolio — Dark Engineering Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    --bg-deep: #060b18;
    --bg-surface: #0c1425;
    --bg-card: rgba(15, 25, 50, 0.6);
    --bg-card-hover: rgba(20, 35, 70, 0.7);

    --text-primary: #e8edf5;
    --text-secondary: #7b8ba8;
    --text-muted: #4a5874;

    --accent: #00d4ff;
    --accent-dim: rgba(0, 212, 255, 0.15);
    --accent-glow: rgba(0, 212, 255, 0.25);
    --accent-secondary: #7c5cfc;
    --accent-secondary-dim: rgba(124, 92, 252, 0.15);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(0, 212, 255, 0.3);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 2rem;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.25s ease;
}
a:hover {
    color: #fff;
}

/* --- Particle Canvas Background --- */
#particle-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

/* =====================
   NAVIGATION
   ===================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1rem 0;
    backdrop-filter: blur(20px);
    background: rgba(6, 11, 24, 0.8);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

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

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

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

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.25s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

/* =====================
   HERO SECTION
   ===================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    padding: 4.5rem 0 0 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle,
        rgba(0, 212, 255, 0.06) 0%,
        rgba(124, 92, 252, 0.04) 40%,
        transparent 70%
    );
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 1rem;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 100px;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent) 50%, var(--accent-secondary) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-title { animation: none; }
    #particle-canvas { display: none; }
}

.hero-summary {
    font-size: 1.5rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 1.5rem;
    line-height: 1.8;
    font-weight: 400;
}

.demo-container {
    width: 100%;
    max-width: 780px;
    margin: 0 auto 1.5rem;
    aspect-ratio: 16 / 9;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0, 212, 255, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(0, 212, 255, 0.05);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-container video.demo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================
   STATS GRID
   ===================== */
.stats-section {
    padding-top: 3rem;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.section-label::before {
    content: '';
    width: 24px;
    height: 2px;
    background: var(--accent);
}

.stats-section h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 2rem 1.5rem;
    border-radius: var(--radius-md);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.35s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card h3 {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ============================================
   SYSTEM ARCHITECTURE — PAIRED LOOP + PUBS
   ============================================ */
.logic-flow {
    padding-top: 3rem;
    position: relative;
}

.logic-flow h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-align: center;
}

.arch-subtitle {
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto 2.5rem;
    text-align: center;
    font-size: 0.95rem;
}

.arch-stack {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.arch-subtitle code {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--accent);
}

.arch-node-bar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.arch-node-meta {
    flex: 1;
    min-width: 0;
}

.arch-node-meta h3 {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.arch-node-meta h3 code {
    color: var(--accent);
}

.arch-node-meta p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.arch-node-meta code {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent);
}

.badge-hz {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    animation: pulseGlow 2s infinite ease-in-out;
    flex-shrink: 0;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* Split control loop + middleware with aligned pub bridges */
.arch-split {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) 40px minmax(0, 0.95fr);
    column-gap: 0.55rem;
    row-gap: 0.35rem;
    align-items: stretch;
    --cycle: 14s;
    padding: 1.15rem 1.1rem;
}

.arch-panel-frame {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: var(--radius-lg);
    pointer-events: none;
    z-index: 0;
}

.arch-panel-frame-loop {
    left: 0;
    width: calc((100% - 40px - 1.1rem) * 1.2 / 2.15 + 1.1rem - 0.275rem);
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: rgba(0, 212, 255, 0.015);
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.05), 0 12px 32px rgba(0, 0, 0, 0.25);
}

.arch-panel-frame-ros {
    right: 0;
    width: calc((100% - 40px - 1.1rem) * 0.95 / 2.15 + 1.1rem - 0.275rem);
    border: 1px solid rgba(0, 212, 255, 0.18);
    background:
        linear-gradient(180deg, rgba(0, 212, 255, 0.04) 0%, transparent 22%),
        var(--bg-surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.arch-split > *:not(.arch-panel-frame) {
    position: relative;
    z-index: 1;
}

.arch-panel-header {
    padding: 0.15rem 0.35rem 0.7rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}

.arch-panel-kicker {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

.arch-panel-header h3 {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.arch-head-gap,
.arch-bridge-gap,
.arch-mid-gap {
    min-height: 0;
}

.arch-mid-gap-fill {
    border-radius: var(--radius-md);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
}

.step-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    animation: controlStep var(--cycle) ease-in-out infinite;
    animation-delay: calc(var(--step) * var(--cycle) / 6);
}

.step-item:hover {
    transform: translateX(3px);
}

@keyframes controlStep {
    0%, 2% {
        border-color: var(--border);
        background: var(--bg-card);
        box-shadow: none;
    }
    5%, 13% {
        border-color: rgba(0, 212, 255, 0.55);
        background: rgba(0, 212, 255, 0.07);
        box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12), 0 0 24px rgba(0, 212, 255, 0.08);
    }
    17%, 100% {
        border-color: var(--border);
        background: var(--bg-card);
        box-shadow: none;
    }
}

.step-flow {
    width: 2px;
    height: 10px;
    margin: 0 auto;
    border-radius: 2px;
    background: rgba(0, 212, 255, 0.2);
    position: relative;
    overflow: hidden;
    animation: flowPipe var(--cycle) ease-in-out infinite;
    animation-delay: calc(var(--step) * var(--cycle) / 6 + var(--cycle) * 0.1);
}

.step-flow::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 60%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: flowDot var(--cycle) ease-in-out infinite;
    animation-delay: inherit;
    opacity: 0;
}

@keyframes flowPipe {
    0%, 100% { background: rgba(0, 212, 255, 0.15); }
    6%, 14% { background: rgba(0, 212, 255, 0.45); }
}

@keyframes flowDot {
    0%, 4% { top: -60%; opacity: 0; }
    6% { opacity: 1; }
    14% { top: 110%; opacity: 0; }
    100% { top: 110%; opacity: 0; }
}

.step-num {
    background: var(--accent-dim);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.step-info {
    flex: 1;
    min-width: 0;
}

.step-info h4 {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.step-info p {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.feedback-return {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.03);
    animation: feedbackPulse var(--cycle) ease-in-out infinite;
    align-self: center;
}

.feedback-arrow {
    color: var(--accent);
    font-size: 1rem;
    line-height: 1;
}

.feedback-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    line-height: 1.35;
}

@keyframes feedbackPulse {
    0%, 80%, 100% {
        border-color: rgba(0, 212, 255, 0.2);
        background: rgba(0, 212, 255, 0.03);
        box-shadow: none;
    }
    84%, 96% {
        border-color: rgba(0, 212, 255, 0.55);
        background: rgba(0, 212, 255, 0.08);
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
    }
}

/* Animated bridges: control loop → publications only */
.arch-bridge {
    position: relative;
    height: 2px;
    align-self: center;
    border-radius: 2px;
    background: rgba(0, 212, 255, 0.18);
    overflow: hidden;
    animation: flowPipeH var(--cycle) ease-in-out infinite;
    animation-delay: calc(var(--step) * var(--cycle) / 6 + var(--cycle) * 0.06);
}

.arch-bridge span {
    position: absolute;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: flowDotH var(--cycle) ease-in-out infinite;
    animation-delay: inherit;
    opacity: 0;
}

@keyframes flowPipeH {
    0%, 100% { background: rgba(0, 212, 255, 0.15); }
    6%, 14% { background: rgba(0, 212, 255, 0.55); }
}

@keyframes flowDotH {
    0%, 4% { left: -20%; opacity: 0; }
    6% { opacity: 1; }
    14% { left: 110%; opacity: 0; }
    100% { left: 110%; opacity: 0; }
}

.arch-io-topic {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.arch-io-topic-joint {
    border-color: rgba(40, 200, 64, 0.35);
    background: rgba(40, 200, 64, 0.04);
}

.topic-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

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

.badge-green {
    background: rgba(40, 200, 64, 0.15);
    color: #28c840;
}

.topic-details {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.topic-details code {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--text-primary);
    font-weight: 600;
}

.topic-details small {
    font-size: 0.66rem;
    color: var(--text-muted);
    line-height: 1.35;
    font-family: var(--font-mono);
}

.topic-details p {
    margin-top: 0.2rem;
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.arch-io-sink {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: rgba(0, 212, 255, 0.05);
    align-self: stretch;
}

.arch-io-sink-mark {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    background: var(--accent-dim);
    flex-shrink: 0;
}

.arch-io-sink strong {
    display: block;
    font-size: 0.84rem;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.arch-io-sink p {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.arch-io-sink code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
}

/* =====================
   CODE WALKTHROUGH
   ===================== */
.code-walkthrough-section {
    padding-top: 3rem;
}

.code-walkthrough-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.code-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.code-tab-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.1rem 1.3rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.code-tab-btn:hover {
    background: rgba(0, 212, 255, 0.04);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.code-tab-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.1);
}

.code-pane-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}

.code-dots {
    display: flex;
    gap: 6px;
}

.code-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}

.code-dots span:first-child { background: #ff5f57; opacity: 0.7; }
.code-dots span:nth-child(2) { background: #ffbd2e; opacity: 0.7; }
.code-dots span:nth-child(3) { background: #28c840; opacity: 0.7; }

.code-filename {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.code-pane-body {
    padding: 1.5rem;
    overflow-x: auto;
    background: #080c16;
}

.code-pane-body pre {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.code-pane-explanation {
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.015);
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.code-pane-explanation strong {
    color: var(--accent);
    font-weight: 600;
}

/* =====================
   TECH STACK SECTION
   ===================== */
.tech-section {
    padding-top: 3rem;
}

.tech-section h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    text-align: center;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    max-width: 800px;
    margin: 0 auto;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.tech-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
}

.tech-item .tech-icon { font-size: 2rem; }
.tech-item .tech-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.tech-item .tech-desc { font-size: 0.78rem; color: var(--text-secondary); text-align: center; }

/* =====================
   TECHNICAL DEEP-DIVE VIEW
   ===================== */
.view-container {
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
}

.view-hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(20px);
}

.deep-dive-view-container {
    max-width: 840px;
    margin: 0 auto;
    padding: 5rem 2rem 0;
}

.back-navigation {
    position: sticky;
    top: 5rem;
    z-index: 10;
    margin-bottom: 2rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
}

.back-btn:hover {
    color: var(--accent);
    border-color: var(--border-hover);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

.deep-dive-header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border);
}

.deep-dive-header h1 {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.deep-dive-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.deep-dive-block {
    margin-bottom: 4rem;
}

.deep-dive-block h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
}

.deep-dive-block p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.math-expression {
    background: #090e19;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-size: 1.2rem;
    color: var(--accent);
    overflow-x: auto;
    text-align: center;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}

.deep-dive-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.85rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.deep-dive-table th, .deep-dive-table td {
    padding: 1rem 1.25rem;
    text-align: left;
}

.deep-dive-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.deep-dive-table td {
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* =====================
   FOOTER
   ===================== */
.footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.25s ease;
}

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

/* =====================
   ANIMATIONS & RESPONSIVE
   ===================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-up { opacity: 0; animation: fadeUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.fade-up-d1 { animation-delay: 0.1s; }
.fade-up-d2 { animation-delay: 0.2s; }
.fade-up-d3 { animation-delay: 0.3s; }

@media (max-width: 960px) {
    .arch-board-labels,
    .arch-row,
    .arch-flow-row {
        grid-template-columns: 1fr;
    }
    .arch-board-labels span:last-child {
        display: none;
    }
    .arch-row-spacer {
        display: none;
    }
    .stats-grid, .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .code-walkthrough-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    html { font-size: 15px; }
    .nav-links { display: none; }
    .stats-grid, .tech-grid {
        grid-template-columns: 1fr;
    }
    .arch-node-bar {
        flex-wrap: wrap;
    }
    .arch-io-sink {
        flex-direction: column;
        align-items: flex-start;
    }
}