:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.85);
    --card-bg-hover: rgba(30, 41, 59, 0.95);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-color: #3b82f6;
    --border-color: rgba(148, 163, 184, 0.15);
    --layer-bg: rgba(15, 23, 42, 0.4);

    /* Layer colors */
    --user-color: #3b82f6;
    --platform-color: #8b5cf6;
    --auto-color: #f59e0b;
    --ops-color: #06b6d4;

    /* Status */
    --status-active: #22c55e;

    /* Service accent colors */
    --allergy-color: #f43f5e;
    --edufit-color: #10b981;
    --hopen-color: #f59e0b;
    --academy-color: #6366f1;
    --newsletter-color: #ec4899;
    --standup-color: #14b8a6;
    --infra-color: #06b6d4;
    --qa-color: #8b5cf6;
    --tobe-color: #f97316;

    /* Connection colors */
    --conn-specific: #ec4899;
    --conn-all: #06b6d4;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background grid */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Ambient glow */
body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.arch-container {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 2rem 3rem;
}

/* ── Header ── */
.arch-header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.arch-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    margin-bottom: 0.4rem;
}

.arch-header .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 300;
}

.arch-nav {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.arch-nav a {
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: all 0.2s;
}

.arch-nav a:hover {
    color: #fff;
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

.arch-nav .nav-arrow {
    font-weight: 400;
    opacity: 0.7;
    margin-right: 0.15rem;
}

/* ── Legend ── */
.arch-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-line {
    width: 24px;
    height: 2px;
    border-radius: 1px;
}

.legend-line.solid {
    background: var(--conn-specific);
}

.legend-line.dashed {
    background: repeating-linear-gradient(
        90deg,
        var(--conn-all) 0,
        var(--conn-all) 4px,
        transparent 4px,
        transparent 8px
    );
}

/* ── Gateway Bar ── */
.gateway-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px;
    animation: fadeInUp 0.6s ease-out 0.15s backwards;
}

.gateway-icon {
    font-size: 1.2rem;
}

.gateway-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
    font-family: 'Inter', monospace;
}

.gateway-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    border-left: 1px solid var(--border-color);
    padding-left: 0.75rem;
}

/* ── Flow Down (between layers) ── */
.flow-down {
    display: flex;
    justify-content: center;
    padding: 0.4rem 0;
}

.flow-line {
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, var(--accent-color), transparent);
    opacity: 0.4;
}

/* ── Layer ── */
.arch-layer {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    background: var(--layer-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.arch-layer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 24px;
    right: 24px;
    height: 1px;
}

.layer-user::before { background: linear-gradient(90deg, transparent, var(--user-color), transparent); }
.layer-platform::before { background: linear-gradient(90deg, transparent, var(--platform-color), transparent); }
.layer-auto::before { background: linear-gradient(90deg, transparent, var(--auto-color), transparent); }
.layer-ops::before { background: linear-gradient(90deg, transparent, var(--ops-color), transparent); }

.layer-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 1rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
}

.layer-user .layer-label { color: var(--user-color); background: rgba(59, 130, 246, 0.1); }
.layer-platform .layer-label { color: var(--platform-color); background: rgba(139, 92, 246, 0.1); }
.layer-auto .layer-label { color: var(--auto-color); background: rgba(245, 158, 11, 0.1); }
.layer-ops .layer-label { color: var(--ops-color); background: rgba(6, 182, 212, 0.1); }

.layer-label .layer-icon {
    font-size: 0.85rem;
}

.layer-scope {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: none;
    letter-spacing: 0;
}

/* ── Node Grid ── */
.node-grid {
    display: grid;
    gap: 1rem;
}

.node-grid.four-col { grid-template-columns: repeat(4, 1fr); }
.node-grid.three-col { grid-template-columns: repeat(3, 1fr); }
.node-grid.two-col { grid-template-columns: repeat(2, 1fr); }
.node-grid.single-col { grid-template-columns: 1fr; }

/* ── Node (Service Card) ── */
.node {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

a.node {
    cursor: pointer;
}

a.node:hover {
    background: var(--card-bg-hover);
    border-color: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.3);
}

/* Top accent bar */
.node::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 12px 12px 0 0;
    opacity: 0.8;
}

.node[data-service="allergy"]::after { background: var(--allergy-color); }
.node[data-service="edufit"]::after { background: var(--edufit-color); }
.node[data-service="hopen"]::after { background: var(--hopen-color); }
.node[data-service="academy"]::after { background: var(--academy-color); }
.node[data-service="newsletter"]::after { background: var(--newsletter-color); }
.node[data-service="standup"]::after { background: var(--standup-color); }
.node[data-service="infra"]::after { background: var(--infra-color); }
.node[data-service="qa"]::after { background: var(--qa-color); }
.node[data-service="tobe"]::after { background: var(--tobe-color); }

/* Node header */
.node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.node-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.node-status {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.node-status.active { color: var(--status-active); background: rgba(34, 197, 94, 0.1); }
.node-status.active .status-dot { background: var(--status-active); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Node name */
.node-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 0.25rem 0;
}

a.node:hover .node-name {
    color: var(--accent-color);
}

/* Node description */
.node-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
}

/* Connection badge (inside node) */
.node-conn-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0.3rem 0.6rem;
    background: rgba(148, 163, 184, 0.06);
    border: 1px dashed rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

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

.badge-dot.specific { background: var(--conn-specific); }
.badge-dot.all { background: var(--conn-all); }

/* Tech stack */
.node-tech {
    font-size: 0.6rem;
    color: rgba(148, 163, 184, 0.6);
    margin-top: auto;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* Target services (InfraWatcher) */
.node-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.node-targets span {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.15);
    color: rgba(6, 182, 212, 0.8);
    font-weight: 500;
}

/* ── Connection Section (between layers) ── */
.conn-section {
    padding: 0.75rem 0;
}

.conn-row {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.conn-row.single {
    gap: 0;
}

.conn-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.conn-vert {
    width: 2px;
    height: 20px;
    background: var(--conn-specific);
    opacity: 0.5;
}

.conn-vert.dashed {
    background: none;
    border-left: 2px dashed var(--conn-all);
    opacity: 0.4;
}

.conn-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
}

.conn-label.pink { color: var(--conn-specific); border-color: rgba(236, 72, 153, 0.25); }
.conn-label.teal { color: var(--conn-all); border-color: rgba(6, 182, 212, 0.25); }
.conn-label.cyan { color: var(--conn-all); border-color: rgba(6, 182, 212, 0.25); }

.conn-note {
    font-size: 0.55rem;
    color: rgba(148, 163, 184, 0.5);
    font-style: italic;
}

/* ── Section Heading (Pipeline, Infra) ── */
.section-heading {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-heading h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 0.3rem;
}

.section-heading p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Pipeline Section ── */
.pipeline-section {
    margin-top: 2.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--layer-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeInUp 0.8s ease-out 0.6s backwards;
}

.pipeline-section::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
}

.pipeline {
    max-width: 720px;
    margin: 0 auto;
}

.pipeline-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    min-width: 130px;
    text-align: center;
    transition: all 0.2s;
}

.pipeline-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.3);
}

.step-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.step-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f1f5f9;
}

.step-desc {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* Step color variants */
.step-green { border-color: rgba(34, 197, 94, 0.25); }
.step-green .step-name { color: #4ade80; }
.step-blue { border-color: rgba(59, 130, 246, 0.25); }
.step-blue .step-name { color: #60a5fa; }
.step-purple { border-color: rgba(139, 92, 246, 0.25); }
.step-purple .step-name { color: #a78bfa; }
.step-cyan { border-color: rgba(6, 182, 212, 0.25); }
.step-cyan .step-name { color: #22d3ee; }
.step-orange { border-color: rgba(249, 115, 22, 0.25); }
.step-orange .step-name { color: #fb923c; }

.pipeline-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    opacity: 0.4;
    flex-shrink: 0;
}

.pipeline-arrow-down {
    text-align: center;
    font-size: 1rem;
    color: var(--text-muted);
    opacity: 0.4;
    padding: 0.3rem 0;
}

/* ── Infrastructure Section ── */
.infra-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--layer-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeInUp 0.8s ease-out 0.7s backwards;
}

.infra-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.infra-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    text-align: center;
    transition: all 0.2s;
}

.infra-card:hover {
    border-color: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px);
}

.infra-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.infra-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #f1f5f9;
}

.infra-detail {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Tech bar */
.infra-tech-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
}

.infra-tech-bar span {
    font-size: 0.6rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    color: rgba(59, 130, 246, 0.8);
    font-weight: 500;
}

/* ── Footer ── */
.arch-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    animation: fadeInUp 1s ease-out 0.6s backwards;
}

.arch-footer-inner {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.arch-footer-logo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    flex-shrink: 0;
}

.arch-footer-content {
    flex: 1;
}

.arch-footer-content h3 {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.arch-footer-text {
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.5;
}

.arch-footer-notice {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: right;
}

/* ── Animations ── */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.gateway-bar { animation: fadeInUp 0.6s ease-out 0.15s backwards; }
.arch-layer { animation: fadeInUp 0.8s ease-out backwards; }
.arch-layer:nth-of-type(1) { animation-delay: 0.2s; }
.arch-layer:nth-of-type(2) { animation-delay: 0.3s; }
.arch-layer:nth-of-type(3) { animation-delay: 0.4s; }
.arch-layer:nth-of-type(4) { animation-delay: 0.5s; }
.conn-section { animation: fadeInUp 0.6s ease-out 0.35s backwards; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .node-grid.four-col,
    .node-grid.three-col {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .pipeline-step {
        min-width: 100px;
        padding: 0.6rem 0.5rem;
    }

    .step-name {
        font-size: 0.65rem;
    }
}

@media (max-width: 640px) {
    .arch-container {
        padding: 1.5rem 1rem 2rem;
    }

    .arch-header h1 {
        font-size: 1.5rem;
    }

    .node-grid.four-col,
    .node-grid.three-col,
    .node-grid.two-col {
        grid-template-columns: 1fr;
    }

    .gateway-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .gateway-desc {
        border-left: none;
        padding-left: 0;
    }

    .arch-legend {
        gap: 0.75rem;
    }

    .conn-row {
        gap: 1.5rem;
        flex-wrap: wrap;
    }

    .infra-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pipeline-row {
        flex-direction: column;
        gap: 0.3rem;
    }

    .pipeline-arrow {
        transform: rotate(90deg);
    }

    .pipeline-step {
        min-width: unset;
        width: 100%;
    }

    .arch-footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
