/* ==========================================================================
   CloudWatchDog — Portfolio Documentation Site
   Premium dark theme with glassmorphism, gradients, and micro-animations
   ========================================================================== */

/* ---- CSS Custom Properties ---- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.6);
    --bg-card-hover: rgba(17, 24, 39, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-1: #6366f1;    /* Indigo */
    --accent-2: #8b5cf6;    /* Violet */
    --accent-3: #06b6d4;    /* Cyan */
    --accent-4: #22d3ee;    /* Light cyan */

    --gradient-primary: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --gradient-text: linear-gradient(135deg, var(--accent-3), var(--accent-1), var(--accent-2));
    --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));

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

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset & Base ---- */
*, *::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-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

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

a:hover {
    color: var(--accent-4);
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-4);
    padding: 2px 7px;
    border-radius: 4px;
}

/* ---- Utility Classes ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all var(--transition-smooth);
    opacity: 0;
    transform: translateY(24px);
}

.glass-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
}

/* ---- Ambient Background ---- */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-1);
    top: -200px;
    right: -100px;
    animation: float-orb 20s ease-in-out infinite;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-3);
    bottom: -150px;
    left: -100px;
    animation: float-orb 25s ease-in-out infinite reverse;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--accent-2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float-orb 18s ease-in-out infinite 5s;
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(40px, -30px); }
    50% { transform: translate(-20px, 50px); }
    75% { transform: translate(30px, 20px); }
}

/* ---- Navigation ---- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    transition: all var(--transition-smooth);
}

.nav.scrolled {
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.15rem;
}

.logo-icon {
    font-size: 1.5rem;
}

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

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    padding: 4px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 1px;
    transition: width var(--transition-fast);
}

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

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

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-cta:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

/* ---- Hero Section ---- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 120px 24px 80px;
}

.hero-content {
    max-width: 800px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 28px;
    animation: fade-in-up 0.8s ease-out;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-3);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); }
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
    animation: fade-in-up 0.8s ease-out 0.15s both;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto 40px;
    animation: fade-in-up 0.8s ease-out 0.3s both;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-bottom: 48px;
    animation: fade-in-up 0.8s ease-out 0.45s both;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-subtle);
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    animation: fade-in-up 0.8s ease-out 0.6s both;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Section Base ---- */
.section {
    position: relative;
    z-index: 1;
    padding: 100px 0;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.section-header {
    text-align: center;
    margin-bottom: 64px;
}

.section-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-3);
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* ---- Problem Section ---- */
.problem-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.problem-card {
    padding: 36px 28px;
    text-align: center;
}

.problem-icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.problem-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.problem-card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ---- Architecture Section ---- */
.arch-diagram {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 48px;
    margin-bottom: 48px;
}

.arch-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.arch-node {
    text-align: center;
    padding: 24px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    min-width: 140px;
    transition: all var(--transition-smooth);
}

.arch-node:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
}

.node-highlight {
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.05);
}

.node-primary {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.1);
}

.node-action {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.node-notify {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.05);
}

.arch-node-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.arch-node-label {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.arch-node-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.arch-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px;
}

.arrow-line {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--border-subtle), var(--accent-1), var(--border-subtle));
    position: relative;
}

.arrow-line::after {
    content: '▶';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    color: var(--accent-1);
}

.arrow-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
}

.arch-outputs {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.arch-output-line {
    width: 2px;
    height: 30px;
    background: linear-gradient(180deg, var(--accent-1), var(--border-subtle));
}

.arch-output-branches {
    display: flex;
    gap: 48px;
    position: relative;
}

.arch-output-branches::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 140px);
    height: 2px;
    background: var(--border-subtle);
}

.arch-output-branch {
    position: relative;
    padding-top: 30px;
}

.arch-output-branch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 30px;
    background: var(--border-subtle);
}

/* Architecture Steps */
.arch-steps {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.arch-step {
    padding: 24px 16px;
    border-left: 2px solid var(--border-subtle);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.arch-step.visible {
    opacity: 1;
    transform: translateY(0);
}

.step-num {
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    line-height: 1;
}

.step-content h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-content p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---- Features Section ---- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    padding: 36px 28px;
}

.feature-icon-wrap {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--gradient-glow);
    border: 1px solid var(--border-subtle);
    margin-bottom: 20px;
    transition: all var(--transition-smooth);
}

.feature-card:hover .feature-icon-wrap {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ---- Code Section ---- */
.code-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.code-tab {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.code-tab:hover {
    border-color: var(--border-glow);
    color: var(--text-primary);
}

.code-tab.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
}

.code-panel {
    display: none;
}

.code-panel.active {
    display: block;
    animation: fade-in-up 0.4s ease-out;
}

.code-block {
    overflow: hidden;
    opacity: 1;
    transform: none;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

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

.code-lang {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.code-block pre {
    padding: 24px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.code-block pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* Syntax highlighting */
.kw { color: #c792ea; }    /* Keywords */
.fn { color: #82aaff; }    /* Functions */
.st { color: #c3e88d; }    /* Strings */
.cm { color: #546e7a; }    /* Comments */
.num { color: #f78c6c; }   /* Numbers */

/* ---- Tech Stack Section ---- */
.tech-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.tech-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    font-weight: 600;
    font-size: 0.92rem;
    opacity: 1;
    transform: none;
}

.tech-badge-icon {
    font-size: 1.5rem;
    width: 36px;
    text-align: center;
}

/* ---- Repository Section ---- */
.repo-tree {
    max-width: 700px;
    margin: 0 auto;
    opacity: 1;
    transform: none;
}

.repo-tree pre {
    padding: 32px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 2;
    color: var(--text-primary);
}

.repo-tree pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.repo-tree .cm {
    color: var(--text-muted);
}

/* ---- Footer ---- */
.footer {
    position: relative;
    z-index: 1;
    padding: 60px 0 40px;
    border-top: 1px solid var(--border-subtle);
}

.footer-content {
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 1.15rem;
    font-weight: 700;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

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

.footer-copy {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ---- Responsive ---- */
@media (max-width: 968px) {
    .problem-grid,
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .arch-steps {
        grid-template-columns: repeat(3, 1fr);
    }

    .arch-flow {
        gap: 16px;
    }

    .nav-links {
        gap: 20px;
    }
}

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

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

    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }

    .stat-divider {
        width: 40px;
        height: 1px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .problem-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .arch-steps {
        grid-template-columns: 1fr;
    }

    .arch-flow {
        flex-direction: column;
    }

    .arch-arrow {
        transform: rotate(90deg);
        padding: 8px 0;
    }

    .arch-output-branches {
        flex-direction: column;
        gap: 16px;
    }

    .arch-output-branches::before {
        display: none;
    }

    .arch-output-branch::before {
        display: none;
    }

    .arch-output-branch {
        padding-top: 0;
    }

    .section {
        padding: 60px 0;
    }

    .code-tabs {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 100px 16px 60px;
    }

    .container {
        padding: 0 16px;
    }

    .arch-diagram {
        padding: 24px 16px;
    }
}
