/* ============================================================
   Helix — Home  (Apple-minimal · Aurora edition)
   ============================================================ */

/* ── Page entrance ──────────────────────────────────────────────────────────── */
body {
    animation: pageFadeIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

main {
    isolation: isolate;
}

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

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

@keyframes softFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 10px 36px rgba(124, 106, 239, 0.22);
    }
    50% {
        box-shadow: 0 14px 42px rgba(124, 106, 239, 0.34);
    }
}

@keyframes borderBreathe {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.055);
    }
    50% {
        border-color: rgba(255, 255, 255, 0.085);
    }
}

@keyframes heroHaloDrift {
    0%, 100% {
        background-position: 0% 50%, 100% 50%;
    }
    50% {
        background-position: 100% 45%, 0% 55%;
    }
}

@keyframes servicesDividerSweep {
    from { background-position: 0% 50%; }
    to { background-position: 180% 50%; }
}

/* ── Login Modal ────────────────────────────────────────────────────────────── */
.login-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}
.login-overlay.show { display: flex; }

.login-modal {
    background: rgba(18, 18, 22, 0.95);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    padding: 44px 36px;
    width: 360px;
    max-width: calc(100vw - 32px);
    text-align: center;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
}
.login-modal h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 4px; }
.login-sub { color: var(--color-text-muted); font-size: 0.83rem; margin-bottom: 28px; }
.login-modal input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    color: var(--color-text);
    font-size: 0.92rem;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 250ms ease, box-shadow 250ms ease;
    font-family: var(--font-sans);
}
.login-modal input:focus {
    border-color: rgba(124, 106, 239, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 106, 239, 0.1);
}
.login-submit { width: 100%; justify-content: center; margin-top: 6px; }
.login-error { color: #f87171; font-size: 0.82rem; margin-top: 10px; min-height: 1.2em; }

/* ── Noise ──────────────────────────────────────────────────────────────────── */
.noise-overlay { display: none; }

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
    position: relative;
    min-height: 68vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 90px 0 70px;
}

/* Very faint static gradient — aurora canvas handles the colour */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(124, 106, 239, 0.03) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* Bottom blend into page */
.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--color-bg));
    z-index: 2;
    pointer-events: none;
}

#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

.hero > .container {
    position: relative;
    z-index: 3;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title,
.hero-subtitle,
.hero-actions,
.section-header,
.service-card {
    opacity: 0;
    animation: riseIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-title { animation-delay: 80ms; }
.hero-subtitle { animation-delay: 180ms; }
.hero-actions { animation-delay: 280ms; }
.section-header { animation-delay: 380ms; }
.service-card:nth-child(1) { animation-delay: 460ms; }
.service-card:nth-child(2) { animation-delay: 520ms; }
.service-card:nth-child(3) { animation-delay: 580ms; }
.service-card:nth-child(4) { animation-delay: 640ms; }
.service-card:nth-child(5) { animation-delay: 700ms; }
.service-card:nth-child(6) { animation-delay: 760ms; }
.service-card:nth-child(7) { animation-delay: 820ms; }
.service-card:nth-child(8) { animation-delay: 880ms; }
.service-card:nth-child(9) { animation-delay: 940ms; }

/* Title */
.hero-title {
    font-size: clamp(4.5rem, 12vw, 8rem);
    font-weight: 700;
    letter-spacing: -5px;
    line-height: 1.0;
    margin-bottom: 20px;
    color: var(--color-text);
}

.hero-title span {
    background: linear-gradient(160deg, #ececf1 0%, #b8a4fc 50%, #7c6aef 100%);
    background-size: 180% 180%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShift 12s ease-in-out infinite;
}

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

/* Subtitle — minimal, one line */
.hero-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    max-width: 340px;
    margin: 0 auto 36px;
    line-height: 1.65;
    font-weight: 400;
    opacity: 0.75;
}

/* CTA */
.hero-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn-glow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #7c6aef 0%, #9580fa 100%);
    transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 400ms ease,
                filter 400ms ease;
    text-decoration: none;
    letter-spacing: 0.01em;
    animation: glowPulse 4.8s ease-in-out infinite;
}
.btn-glow:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 36px rgba(124, 106, 239, 0.38);
    filter: brightness(1.07);
    color: #fff;
}

.btn-glass {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1),
                border-color 400ms ease,
                color 400ms ease,
                background 400ms ease,
                box-shadow 400ms ease;
    text-decoration: none;
    letter-spacing: 0.01em;
}
.btn-glass:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.07);
    color: var(--color-text);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.2);
}

/* ── Services section ───────────────────────────────────────────────────────── */
.services {
    padding: 0 0 80px;
}

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

.section-label {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--color-text-muted);
    opacity: 0.5;
}

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.service-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 26px 22px 20px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 18px;
    text-decoration: none;
    overflow: hidden;
    transition: transform 520ms cubic-bezier(0.23, 1, 0.32, 1),
                border-color 520ms ease,
                background 520ms ease,
                box-shadow 520ms ease;
    -webkit-tap-highlight-color: transparent;
    animation-name: riseIn, borderBreathe;
    animation-duration: 0.9s, 6s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1), ease-in-out;
    animation-fill-mode: forwards, both;
    animation-iteration-count: 1, infinite;
}
.service-card:hover {
    transform: translateY(-6px) scale(1.012);
    background: rgba(255, 255, 255, 0.042);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(124, 106, 239, 0.07);
}

/* ── Card icon ──────────────────────────────────────────────────────────────── */
.card-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    flex-shrink: 0;
    transition: transform 520ms cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 520ms ease;
    animation: softFloat 5.2s ease-in-out infinite;
}
.service-card:hover .card-icon-wrap { transform: scale(1.1); }

.service-card:nth-child(2n) .card-icon-wrap {
    animation-duration: 6.2s;
}

.service-card:nth-child(3n) .card-icon-wrap {
    animation-duration: 7s;
}

.card-icon-wrap svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Color variants */
.card-icon-wrap.purple { background: rgba(167,139,250,.09); }
.card-icon-wrap.purple svg { stroke: #a78bfa; }
.service-card:hover .card-icon-wrap.purple { box-shadow: 0 0 26px rgba(167,139,250,.2); }

.card-icon-wrap.pink { background: rgba(244,114,182,.09); }
.card-icon-wrap.pink svg { stroke: #f472b6; }
.service-card:hover .card-icon-wrap.pink { box-shadow: 0 0 26px rgba(244,114,182,.2); }

.card-icon-wrap.cyan { background: rgba(34,211,238,.09); }
.card-icon-wrap.cyan svg { stroke: #22d3ee; }
.service-card:hover .card-icon-wrap.cyan { box-shadow: 0 0 26px rgba(34,211,238,.2); }

.card-icon-wrap.blue { background: rgba(96,165,250,.09); }
.card-icon-wrap.blue svg { stroke: #60a5fa; }
.service-card:hover .card-icon-wrap.blue { box-shadow: 0 0 26px rgba(96,165,250,.2); }

.card-icon-wrap.green { background: rgba(52,211,153,.09); }
.card-icon-wrap.green svg { stroke: #34d399; }
.service-card:hover .card-icon-wrap.green { box-shadow: 0 0 26px rgba(52,211,153,.2); }

.card-icon-wrap.orange { background: rgba(249,115,22,.09); }
.card-icon-wrap.orange svg { stroke: #f97316; }
.service-card:hover .card-icon-wrap.orange { box-shadow: 0 0 26px rgba(249,115,22,.2); }

/* ── Card body ──────────────────────────────────────────────────────────────── */
.card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.card-title-row h3 {
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

.card-body p {
    font-size: 0.83rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    flex: 1;
    margin: 0;
    opacity: 0.8;
}

/* ── CTA link ───────────────────────────────────────────────────────────────── */
.card-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 18px;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(167, 139, 250, 0.55);
    transition: color 450ms ease, gap 450ms cubic-bezier(0.23, 1, 0.32, 1);
}
.card-cta svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1);
}
.service-card:hover .card-cta { color: #a78bfa; gap: 8px; }
.service-card:hover .card-cta svg { transform: translateX(3px); }

/* ── Status dot ─────────────────────────────────────────────────────────────── */
.status-dot-live {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 600ms ease, background 600ms ease, box-shadow 600ms ease;
}
.status-dot-live.online  { opacity:1; background:#34d399; box-shadow:0 0 5px rgba(52,211,153,.5); }
.status-dot-live.offline { opacity:1; background:#f87171; box-shadow:0 0 5px rgba(248,113,113,.5); animation: pulse-red 2s ease-in-out infinite; }
.status-dot-live.unknown { opacity:0.4; background:#555; }
.status-dot-live.rainbow { opacity:1; background:hsl(0 100% 60%); box-shadow:0 0 7px hsla(0,100%,60%,.65); animation: rainbow-cycle 2.8s linear infinite; }

@keyframes pulse-red {
    0%,100% { opacity:1; } 50% { opacity:0.45; }
}
@keyframes rainbow-cycle {
    0%   { background:hsl(0   100% 60%); box-shadow:0 0 7px hsla(0,  100%,60%,.6); }
    20%  { background:hsl(48  100% 58%); box-shadow:0 0 7px hsla(48, 100%,58%,.6); }
    40%  { background:hsl(120  75% 55%); box-shadow:0 0 7px hsla(120, 75%,55%,.6); }
    60%  { background:hsl(195 100% 56%); box-shadow:0 0 7px hsla(195,100%,56%,.6); }
    80%  { background:hsl(268 100% 66%); box-shadow:0 0 7px hsla(268,100%,66%,.6); }
    100% { background:hsl(345 100% 63%); box-shadow:0 0 7px hsla(345,100%,63%,.6); }
}

/* Desktop-first homepage motion pass */
@media (hover: hover) and (pointer: fine) {
    .hero::before {
        background:
            radial-gradient(ellipse 72% 56% at 24% 44%, rgba(124, 106, 239, 0.1) 0%, transparent 70%),
            radial-gradient(ellipse 68% 54% at 78% 56%, rgba(34, 211, 238, 0.08) 0%, transparent 72%);
        background-size: 155% 155%, 165% 165%;
        animation: heroHaloDrift 16s ease-in-out infinite;
    }

    .hero.reveal-on-scroll {
        transform: translateY(22px) scale(0.995);
        filter: blur(4px);
    }

    .hero.reveal-on-scroll.is-visible {
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    .services {
        position: relative;
    }

    .services::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        width: min(760px, 76vw);
        height: 1px;
        transform: translateX(-50%);
        background: linear-gradient(90deg, transparent 0%, rgba(124, 106, 239, 0.88) 50%, transparent 100%);
        background-size: 180% 100%;
        opacity: 0.62;
        pointer-events: none;
        animation: servicesDividerSweep 8.4s linear infinite;
    }

    .services.reveal-on-scroll {
        transition-delay: calc(var(--reveal-delay, 0ms) + 90ms);
    }

    .service-card {
        will-change: transform, box-shadow;
    }

    .service-card::before {
        content: '';
        position: absolute;
        inset: -18% -130%;
        background: linear-gradient(104deg, transparent 38%, rgba(255, 255, 255, 0.09) 50%, transparent 62%);
        transform: translateX(-58%);
        pointer-events: none;
        transition: transform 640ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    .service-card:hover::before {
        transform: translateX(58%);
    }

    .card-title-row h3 {
        transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), color 320ms ease;
    }

    .service-card:hover .card-title-row h3 {
        transform: translateX(1px);
        color: #f4f2ff;
    }
}

/* ── Tablet ──────────────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .services-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile app-launcher ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body   { min-height: 100dvh; height: auto; overflow-x: hidden; overflow-y: auto; }
    main   { min-height: 100dvh; height: auto; display: flex; flex-direction: column; }
    .hero  { display: none; }

    .services {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 16px 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .section-header { margin-bottom: 12px; }

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

    .service-card {
        align-items: center;
        text-align: center;
        padding: 16px 10px 12px;
        border-radius: 16px;
    }

    .card-icon-wrap { margin-bottom: 8px; }
    .card-title-row { justify-content: center; margin-bottom: 0; }
    .card-title-row h3 { font-size: 0.72rem; }
    .card-body p, .card-cta, .status-dot-live { display: none; }
}

/* Touch */
@media (pointer: coarse) {
    .service-card:hover { transform: none; box-shadow: none; background: rgba(255,255,255,.025); border-color: rgba(255,255,255,.055); }
    .service-card:active { transform: scale(0.96); transition-duration: 90ms; }
    .btn-glow:hover, .btn-glass:hover { transform: none; filter: none; box-shadow: none; }
    .btn-glow:active, .btn-glass:active { transform: scale(0.97); transition-duration: 80ms; }
}

@media (prefers-reduced-motion: reduce) {
    body,
    .hero-title,
    .hero-subtitle,
    .hero-actions,
    .section-header,
    .service-card,
    .card-icon-wrap,
    .btn-glow,
    .hero-title span {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
