/* ================================================
   site_gate — AI Chatbot Platform Landing Page
   All colors driven by CSS custom properties.
   Override --sg-* variables on :root to re-theme.
   ================================================ */

/* --- Theme Variables (defaults) --- */
:root {
    /* Background */
    --sg-bg: #0e0e11;
    --sg-bg-card: rgba(255, 255, 255, 0.025);
    --sg-bg-elevated: #18181d;

    /* Accent (primary purple) */
    --sg-accent: #7C5CFC;
    --sg-accent-dark: #5B3FD4;
    --sg-accent-light: #9b7dff;
    --sg-accent-005: rgba(124, 92, 252, 0.05);
    --sg-accent-008: rgba(124, 92, 252, 0.08);
    --sg-accent-010: rgba(124, 92, 252, 0.1);
    --sg-accent-012: rgba(124, 92, 252, 0.12);
    --sg-accent-015: rgba(124, 92, 252, 0.15);
    --sg-accent-020: rgba(124, 92, 252, 0.2);
    --sg-accent-030: rgba(124, 92, 252, 0.3);
    --sg-accent-040: rgba(124, 92, 252, 0.4);

    /* Text */
    --sg-text: #c8c8d0;
    --sg-text-heading: #f0f0f4;
    --sg-text-sub: #8a8a96;
    --sg-text-muted: #6e6e7a;
    --sg-text-faint: #4a4a56;
    --sg-text-bright: #e0e0e6;

    /* Border / Surface */
    --sg-border: rgba(255, 255, 255, 0.06);
    --sg-border-light: rgba(255, 255, 255, 0.05);
    --sg-border-lighter: rgba(255, 255, 255, 0.04);
    --sg-surface-hover: rgba(255, 255, 255, 0.02);
    --sg-scrollbar: rgba(255, 255, 255, 0.08);

    /* Status (maintenance badge) */
    --sg-status: #f0ad4e;
    --sg-status-bg: rgba(240, 173, 78, 0.1);
    --sg-status-border: rgba(240, 173, 78, 0.18);

    /* Chat window dots */
    --sg-dot-red: #ff5f57;
    --sg-dot-yellow: #febc2e;
    --sg-dot-green: #28c840;

    /* AI bubble text */
    --sg-ai-bubble-text: #d0c8f0;

    /* Nav background (rgba for glassmorphic transparency) */
    --sg-nav-bg: rgba(14, 14, 17, 0.72);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--sg-bg);
    color: var(--sg-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Film Grain Overlay --- */
.sg-grain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.035;
    background-image: 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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px;
}

/* --- Floating Orbs --- */
.sg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.sg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.18;
    will-change: transform;
}

.sg-orb--1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--sg-accent) 0%, transparent 70%);
    top: -15%;
    right: -10%;
    animation: sg-orb-float-1 18s ease-in-out infinite alternate;
}

.sg-orb--2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--sg-accent-dark) 0%, transparent 70%);
    bottom: -10%;
    left: -8%;
    animation: sg-orb-float-2 22s ease-in-out infinite alternate;
}

.sg-orb--3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--sg-accent-light) 0%, transparent 70%);
    top: 45%;
    left: 50%;
    animation: sg-orb-float-3 15s ease-in-out infinite alternate;
}

@keyframes sg-orb-float-1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-60px, 40px) scale(1.15); }
}

@keyframes sg-orb-float-2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -30px) scale(1.1); }
}

@keyframes sg-orb-float-3 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-40px, -50px) scale(0.9); }
}

/* --- Navigation --- */
.sg-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    background: var(--sg-nav-bg);
    border-bottom: 1px solid var(--sg-accent-008);
}

.sg-nav__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sg-nav__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-nav__logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
}

.sg-nav__logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sg-nav__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--sg-text-heading);
    letter-spacing: -0.01em;
}

.sg-nav__actions {
    display: flex;
    align-items: center;
}

.sg-nav__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--sg-status);
    background: var(--sg-status-bg);
    border: 1px solid var(--sg-status-border);
    padding: 4px 12px;
    border-radius: 100px;
}

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

@keyframes sg-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* --- Hero Section --- */
.sg-hero {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 120px 24px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sg-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--sg-accent-light);
    background: var(--sg-accent-008);
    border: 1px solid var(--sg-accent-015);
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 20px;
    animation: sg-fadeInUp 0.6s ease both;
}

.sg-hero__title {
    font-size: 42px;
    font-weight: 700;
    color: var(--sg-text-heading);
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    animation: sg-fadeInUp 0.6s ease 0.1s both;
}

.sg-hero__desc {
    font-size: 16px;
    line-height: 1.7;
    color: var(--sg-text-sub);
    max-width: 520px;
    animation: sg-fadeInUp 0.6s ease 0.2s both;
}

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

/* --- Chat Preview --- */
.sg-chat {
    background: var(--sg-bg-elevated);
    border: 1px solid var(--sg-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px var(--sg-accent-005),
        0 20px 60px -12px rgba(0, 0, 0, 0.5),
        0 0 120px -40px var(--sg-accent-012);
    animation: sg-fadeInUp 0.8s ease 0.3s both;
}

.sg-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--sg-surface-hover);
    border-bottom: 1px solid var(--sg-border-light);
}

.sg-chat__header-dots {
    display: flex;
    gap: 5px;
}

.sg-chat__header-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sg-scrollbar);
}

.sg-chat__header-dots span:first-child { background: var(--sg-dot-red); }
.sg-chat__header-dots span:nth-child(2) { background: var(--sg-dot-yellow); }
.sg-chat__header-dots span:nth-child(3) { background: var(--sg-dot-green); }

.sg-chat__header-title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--sg-text-sub);
}

.sg-chat__header-badge {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--sg-accent);
    background: var(--sg-accent-010);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

.sg-chat__body {
    padding: 20px 16px;
    min-height: 200px;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Scrollbar */
.sg-chat__body::-webkit-scrollbar {
    width: 4px;
}
.sg-chat__body::-webkit-scrollbar-track {
    background: transparent;
}
.sg-chat__body::-webkit-scrollbar-thumb {
    background: var(--sg-scrollbar);
    border-radius: 2px;
}

/* Messages */
.sg-chat__msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.sg-chat__avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.sg-chat__avatar--user {
    background: linear-gradient(135deg, #3a3a4a, #2a2a38);
    color: var(--sg-text);
}

.sg-chat__avatar--ai {
    background: linear-gradient(135deg, var(--sg-accent), var(--sg-accent-dark));
    color: #fff;
}

.sg-chat__bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    max-width: 85%;
}

.sg-chat__bubble--user {
    background: var(--sg-border-light);
    color: var(--sg-text);
    border: 1px solid var(--sg-border);
}

.sg-chat__bubble--ai {
    background: var(--sg-accent-008);
    color: var(--sg-ai-bubble-text);
    border: 1px solid var(--sg-accent-012);
}

/* Message animation */
.sg-anim-msg {
    opacity: 0;
    transform: translateY(10px);
    animation: sg-fadeInUp 0.5s ease forwards;
    animation-delay: var(--delay, 0s);
}

/* Typing cursor */
.sg-chat__cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--sg-accent);
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: sg-blink 0.8s step-end infinite;
}

@keyframes sg-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Features Section --- */
.sg-features {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 64px 24px 40px;
}

.sg-features__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.sg-features__card {
    background: var(--sg-bg-card);
    border: 1px solid var(--sg-border-light);
    border-radius: 14px;
    padding: 28px 22px;
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.sg-features__card:hover {
    border-color: var(--sg-accent-020);
    background: rgba(124, 92, 252, 0.04);
    transform: translateY(-2px);
}

.sg-features__icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: var(--sg-accent-010);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: var(--sg-accent-light);
}

.sg-features__card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--sg-text-bright);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.sg-features__card p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--sg-text-muted);
}

/* Card entrance animation */
.sg-anim-card {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: var(--delay, 0s);
}

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

/* --- Integrations --- */
.sg-integrations {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 24px 40px;
    text-align: center;
}

.sg-integrations__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sg-text-faint);
    margin-bottom: 20px;
}

.sg-integrations__logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.sg-integrations__item {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--sg-text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: color 0.25s ease;
}

.sg-integrations__item:hover {
    color: var(--sg-accent-light);
}

/* --- QR Code --- */
.sg-qr-section {
    position: relative;
    z-index: 1;
    padding: 20px 24px 24px;
    display: flex;
    justify-content: center;
}

.sg-qr-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--sg-border);
    border-radius: 16px;
    padding: 28px 36px;
    text-align: center;
}

.sg-qr-card__img img {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    border: 2px solid var(--sg-accent-015);
    padding: 4px;
    background: #fff;
}

.sg-qr-card__tip {
    margin-top: 12px;
    font-size: 12px;
    color: var(--sg-text-muted);
}

/* --- CTA Button --- */
.sg-cta {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 24px 24px;
}

.sg-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--sg-accent) 0%, var(--sg-accent-dark) 100%);
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow:
        0 4px 16px var(--sg-accent-030),
        0 0 0 1px var(--sg-accent-020);
}

.sg-cta__btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 8px 28px var(--sg-accent-040),
        0 0 0 1px rgba(124, 92, 252, 0.35);
}

.sg-cta__btn:active {
    transform: translateY(0);
}

/* --- Footer --- */
.sg-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 24px 40px;
    border-top: 1px solid var(--sg-border-lighter);
    max-width: 960px;
    margin: 24px auto 0;
}

.sg-footer__copyright {
    font-size: 12px;
    color: var(--sg-text-faint);
    margin-bottom: 4px;
}

.sg-footer__icp {
    font-size: 11px;
}

.sg-footer__icp a {
    color: var(--sg-text-faint);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sg-footer__icp a:hover {
    color: var(--sg-accent-light);
}

/* ============================
   Responsive — Tablet
   ============================ */
@media (max-width: 768px) {
    .sg-hero {
        padding-top: 96px;
    }

    .sg-hero__title {
        font-size: 32px;
    }

    .sg-hero__desc {
        max-width: 100%;
    }

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

    .sg-integrations__logos {
        gap: 20px;
    }
}

/* ============================
   Responsive — Mobile
   ============================ */
@media (max-width: 480px) {
    .sg-nav__inner {
        padding: 0 16px;
        height: 48px;
    }

    .sg-nav__name {
        font-size: 14px;
    }

    .sg-hero {
        padding: 80px 16px 24px;
    }

    .sg-hero__title {
        font-size: 26px;
    }

    .sg-hero__desc {
        font-size: 14px;
    }

    .sg-chat {
        border-radius: 12px;
    }

    .sg-chat__body {
        min-height: 160px;
        max-height: 220px;
        padding: 16px 12px;
    }

    .sg-features {
        padding: 40px 16px 24px;
    }

    .sg-features__grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sg-features__card {
        padding: 22px 18px;
    }

    .sg-integrations {
        padding: 16px 16px 24px;
    }

    .sg-integrations__logos {
        gap: 16px;
    }

    .sg-integrations__item span {
        display: none;
    }

    .sg-qr-card {
        padding: 22px 28px;
    }

    .sg-qr-card__img img {
        width: 100px;
        height: 100px;
    }

    .sg-cta {
        padding: 24px 16px 16px;
    }

    .sg-cta__btn {
        padding: 11px 24px;
        font-size: 13px;
    }

    .sg-footer {
        padding: 24px 16px 32px;
    }
}
