/* ════════════════════════════════════════════════════════════
   PipeProxy — Premium Landing Page
   ════════════════════════════════════════════════════════════ */

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

/* ── Tokens ───────────────────────────────────────────────── */
:root {
    --bg: #08090d;
    --bg-raised: #0e1017;
    --bg-surface: #13151c;
    --bg-hover: #1a1c26;

    --accent: #4f8ffa;
    --accent-alt: #7c5cfc;
    --accent-dim: rgba(79, 143, 250, .08);
    --accent-border: rgba(79, 143, 250, .12);

    --green: #34d399;
    --amber: #fbbf24;
    --rose: #fb7185;

    --text-primary: #f0f2f5;
    --text-secondary: #8b93a7;
    --text-tertiary: #555d72;

    --border: rgba(255, 255, 255, .05);
    --border-subtle: rgba(255, 255, 255, .03);

    --font-display: 'Space Grotesk', -apple-system, system-ui, sans-serif;
    --font-body: 'Inter', -apple-system, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    --max-w: 1180px;
    --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    /* Offset for sticky nav */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    /* Prevent horizontal scroll at root level */
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-secondary);
    line-height: 1.65;
    overflow-x: hidden;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color .2s var(--ease);
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

::selection {
    background: rgba(79, 143, 250, .25);
    color: #fff;
}

/* ── Container ────────────────────────────────────────────── */
.w {
    max-width: var(--max-w);
    margin-inline: auto;
    padding-inline: clamp(16px, 5vw, 40px);
    /* Slightly less padding on tiny screens */
    width: 100%;
}

/* ════════════════════════════════════════════════════════════
   NAVIGATION
   ════════════════════════════════════════════════════════════ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 18px 0;
    transition: all .35s var(--ease);
}

.nav::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(8, 9, 13, .6);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transition: opacity .35s var(--ease);
}

.nav.scrolled::before {
    opacity: 1;
}

.nav.scrolled {
    padding: 12px 0;
}

.nav__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: -.02em;
}

.logo img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.logo span {
    opacity: .5;
    font-weight: 400;
}

/* Nav links */
.nav__links {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
}

.nav__links a {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: color .2s var(--ease);
}

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

.nav__cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .8125rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--bg);
    transition: all .2s var(--ease);
}

.nav__cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(240, 242, 245, .15);
    color: var(--bg);
}

.nav__cta svg {
    width: 16px;
    height: 16px;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
}

.hamburger span {
    width: 20px;
    height: 1.5px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: transform .3s var(--ease), opacity .3s var(--ease);
}

.hamburger.open span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ════════════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════════════ */
.hero {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding: 140px 0 100px;
}

/* Single ambient glow — very subtle */
.hero::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(79, 143, 250, .06) 0%, transparent 70%);
    pointer-events: none;
}

/* Noise texture overlay */
.hero::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: .4;
    pointer-events: none;
}

.hero__content {
    max-width: 740px;
}

.hero__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--green);
    margin-bottom: 32px;
    opacity: 0;
    animation: slideUp .6s .1s var(--ease) forwards;
}

.hero__tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .3;
    }
}

.hero__h1 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 8vw, 4.5rem);
    /* Increased scale factor, lower min for tiny screens */
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.035em;
    color: var(--text-primary);
    margin-bottom: 24px;
    opacity: 0;
    animation: slideUp .6s .15s var(--ease) forwards;
    overflow-wrap: break-word;
}

.hero__h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero__desc {
    font-size: clamp(1rem, 1.8vw, 1.175rem);
    line-height: 1.7;
    max-width: 560px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    opacity: 0;
    animation: slideUp .6s .25s var(--ease) forwards;
}

.hero__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    opacity: 0;
    animation: slideUp .6s .35s var(--ease) forwards;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .875rem;
    padding: 12px 24px;
    border-radius: 10px;
    transition: all .2s var(--ease);
}

.btn--primary {
    background: var(--accent);
    color: #fff;
}

.btn--primary:hover {
    background: #6ba3fb;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 143, 250, .25);
    color: #fff;
}

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

.btn--ghost:hover {
    border-color: rgba(255, 255, 255, .12);
    color: var(--text-primary);
    background: rgba(255, 255, 255, .04);
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* Terminal Preview */
.hero__preview {
    margin-top: 72px;
    opacity: 0;
    animation: slideUp .6s .45s var(--ease) forwards;
}

.terminal {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .02),
        0 20px 50px -12px rgba(0, 0, 0, .6),
        0 0 100px -20px rgba(79, 143, 250, .04);
}

.terminal__chrome {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 13px 16px;
    background: rgba(255, 255, 255, .015);
    border-bottom: 1px solid var(--border);
}

.terminal__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-tertiary);
    opacity: .3;
}

.terminal__label {
    flex: 1;
    text-align: center;
    font-family: var(--font-mono);
    font-size: .7rem;
    color: var(--text-tertiary);
    letter-spacing: .02em;
}

.terminal__code {
    padding: 20px 22px;
    font-family: var(--font-mono);
    font-size: .8rem;
    line-height: 1.85;
    color: var(--text-tertiary);
    overflow-x: auto;
}

.terminal__code .c {
    color: var(--text-tertiary);
    opacity: .5;
}

.terminal__code .p {
    color: var(--accent);
}

.terminal__code .v {
    color: var(--text-primary);
}

.terminal__code .s {
    color: var(--green);
}

.terminal__code .w {
    color: var(--amber);
}

/* ════════════════════════════════════════════════════════════
   METRICS STRIP
   ════════════════════════════════════════════════════════════ */
.metrics {
    padding: 80px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.metrics__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.metric__value {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.03em;
    line-height: 1;
    margin-bottom: 8px;
}

.metric__label {
    font-size: .8125rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   SECTIONS — common
   ════════════════════════════════════════════════════════════ */
.section {
    padding: 120px 0;
}

.section__header {
    max-width: 560px;
    margin-bottom: 64px;
}

.section__header.centered {
    margin-inline: auto;
    text-align: center;
}

.section__label {
    display: inline-block;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
}

.section__title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.025em;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.section__desc {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════
   FEATURES — Bento-style grid
   ════════════════════════════════════════════════════════════ */
.bento {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.bento__item {
    background: var(--bg);
    padding: 36px 32px;
    transition: background .3s var(--ease);
}

.bento__item:hover {
    background: var(--bg-raised);
}

.bento__item.span-2 {
    grid-column: span 2;
}

.bento__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

.bento__icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bento__item h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -.01em;
}

.bento__item p {
    font-size: .875rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════
   ARCHITECTURE — vertical flow diagram
   ════════════════════════════════════════════════════════════ */
.flow {
    max-width: 680px;
}

.flow__row {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 24px;
}

.flow__row--connector {
    min-height: 48px;
}

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

.flow__num {
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 700;
    color: var(--accent);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--accent-border);
    background: var(--accent-dim);
    flex-shrink: 0;
}

.flow__line {
    flex: 1;
    width: 1px;
    background: repeating-linear-gradient(to bottom,
            var(--text-tertiary) 0px,
            var(--text-tertiary) 4px,
            transparent 4px,
            transparent 8px);
    opacity: .25;
    margin: 8px 0 0;
}

.flow__connector-line {
    width: 1px;
    height: 100%;
    background: repeating-linear-gradient(to bottom,
            var(--text-tertiary) 0px,
            var(--text-tertiary) 4px,
            transparent 4px,
            transparent 8px);
    opacity: .25;
}

.flow__detail {
    padding-bottom: 8px;
}

.flow__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.flow__head h4 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -.01em;
}

.flow__tag {
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.flow__tag--purple {
    background: rgba(124, 92, 252, .08);
    color: var(--accent-alt);
    border-color: rgba(124, 92, 252, .15);
}

.flow__tag--green {
    background: rgba(52, 211, 153, .08);
    color: var(--green);
    border-color: rgba(52, 211, 153, .15);
}

.flow__detail p {
    font-size: .875rem;
    line-height: 1.65;
    color: var(--text-secondary);
    max-width: 540px;
}

.flow__wire {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--text-tertiary);
    opacity: .6;
}

.flow__wire span {
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .02em;
}

/* ════════════════════════════════════════════════════════════
   SECURITY — split layout
   ════════════════════════════════════════════════════════════ */
.sec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.sec-item {
    background: var(--bg);
    padding: 32px;
    transition: background .3s var(--ease);
}

.sec-item:hover {
    background: var(--bg-raised);
}

.sec-item h4 {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.sec-item p {
    font-size: .84rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ════════════════════════════════════════════════════════════
   QUICKSTART — numbered steps
   ════════════════════════════════════════════════════════════ */
.steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.step {
    display: grid;
    grid-template-columns: 64px 1fr;
    border-bottom: 1px solid var(--border);
    padding: 40px 0;
}

.step:last-child {
    border-bottom: none;
}

.step__num {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-tertiary);
    opacity: .4;
    padding-top: 2px;
}

.step__content h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.step__content p {
    font-size: .875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    max-width: 520px;
}

.code {
    display: block;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: .78rem;
    line-height: 1.8;
    color: var(--text-secondary);
    overflow-x: auto;
    max-width: 100%;
    /* Changed from 560px to 100% to prevent overflow */
    word-break: break-word;
}

.code .c {
    opacity: .4;
}

/* ════════════════════════════════════════════════════════════
   CTA
   ════════════════════════════════════════════════════════════ */
.cta {
    padding: 120px 0 100px;
    text-align: center;
    position: relative;
}

.cta::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(79, 143, 250, .04) 0%, transparent 70%);
    pointer-events: none;
}

.cta__title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.03em;
    margin-bottom: 16px;
}

.cta__desc {
    font-size: 1.05rem;
    max-width: 460px;
    margin-inline: auto;
    margin-bottom: 36px;
    color: var(--text-secondary);
}

.cta__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════ */
.footer {
    border-top: 1px solid var(--border);
    padding: 36px 0;
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer__left {
    font-size: .8rem;
    color: var(--text-tertiary);
}

.footer__left a {
    color: var(--accent);
    transition: color .2s var(--ease);
}

.footer__left a:hover {
    color: #6ba3fb;
}

.footer__right {
    display: flex;
    gap: 20px;
    list-style: none;
}

.footer__right a {
    font-size: .8rem;
    color: var(--text-tertiary);
    transition: color .2s var(--ease);
}

.footer__right a:hover {
    color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════ */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .5s var(--ease), transform .5s var(--ease);
}

.reveal.visible {
    opacity: 1;
    transform: none;
}

/* stagger children */
.stagger .reveal:nth-child(1) {
    transition-delay: .0s;
}

.stagger .reveal:nth-child(2) {
    transition-delay: .04s;
}

.stagger .reveal:nth-child(3) {
    transition-delay: .08s;
}

.stagger .reveal:nth-child(4) {
    transition-delay: .12s;
}

.stagger .reveal:nth-child(5) {
    transition-delay: .16s;
}

.stagger .reveal:nth-child(6) {
    transition-delay: .20s;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media(max-width:1024px) {
    .bento {
        grid-template-columns: repeat(2, 1fr);
    }

    /* All span-2 items fill the full 2-column width for better balance */
    .bento__item.span-2 {
        grid-column: span 2;
    }
}

@media(max-width:768px) {
    .hamburger {
        display: flex;
    }

    .nav__links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(8, 9, 13, .98);
        backdrop-filter: blur(20px);
        padding: 24px clamp(20px, 5vw, 40px);
        gap: 16px;
        border-bottom: 1px solid var(--border);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: all .4s var(--ease);
        z-index: -1;
    }

    .nav__links.open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .section {
        padding: 80px 0;
    }

    .metrics__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }

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

    .bento__item.span-2 {
        grid-column: span 1;
    }

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

    .step {
        grid-template-columns: 48px 1fr;
    }

    /* Reduce vertical gaps in flow section for mobile */
    .flow__row--connector {
        min-height: 32px;
    }

    .flow__wire {
        padding: 4px 0;
    }
}

@media(max-width:480px) {
    .hero {
        padding: 120px 0 60px;
        min-height: auto;
    }

    .metrics__grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .hero__actions {
        flex-direction: column;
    }

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

    .cta__actions {
        flex-direction: column;
        align-items: center;
    }

    .footer__inner {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }

    /* Extra compression for tiny nav */
    .nav {
        padding: 12px 0;
    }

    .logo {
        font-size: 1.1rem;
        gap: 8px;
    }

    .logo img {
        width: 26px;
        height: 26px;
    }

    /* Stack steps on small screens to save width */
    .step {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 32px 0;
    }

    .step__num {
        font-size: 1.1rem;
    }

    /* Ensure terminal is readable but compact on tiny screens */
    .terminal__code {
        padding: 16px;
        font-size: .75rem;
    }

    .flow__row {
        gap: 16px;
    }
}