/*
 * landing/css/hero.css
 *
 * Hero section — dense, premium SaaS feel.
 *
 * Layers, top to bottom:
 *   1. eyebrow tag       small pill with category markers
 *   2. headline          three stacked lines, middle line accented
 *   3. sub               one crisp sentence on the mechanism
 *   4. primary CTA       install one-liner in a glass pill
 *   5. secondary CTA     "Add to Home Assistant" purple button
 *   6. trust bar         inline row of concrete numbers
 *   7. floating peek     live-looking probe terminal card (desktop only)
 *
 * Typography is Satoshi for display + Geist Mono for UI chrome. Both
 * loaded from Fontshare/Google in index.html — no system-stack fall-
 * back for H1 because character is the whole point here.
 *
 * Mobile-first: every rule below is authored for 375px, then scaled
 * up with min-width media queries at the bottom.
 */

.hero {
    position: relative;
    min-height: 100vh;
    padding: 7rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.hero-inner {
    width: 100%;
    max-width: 1100px;
    text-align: center;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─── Eyebrow ─────────────────────────────────────────────────── */
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: rgba(var(--purple-1), 0.1);
    border: 1px solid rgba(var(--purple-1), 0.25);
    border-radius: 999px;
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(var(--purple-3), 1);
    margin-bottom: 2rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(-10px);
    animation: heroIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.hero-eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(var(--purple-3), 1);
    box-shadow: 0 0 10px rgba(var(--purple-3), 0.8);
    animation: eyebrowPulse 2s ease-in-out infinite;
}

@keyframes eyebrowPulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.8); }
}

/* ─── Headline ────────────────────────────────────────────────── */
.hero-title {
    font-family: 'Satoshi', 'Inter', -apple-system, sans-serif;
    font-weight: 700;
    font-size: clamp(2.25rem, 10vw, 6rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    color: #ffffff;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1em;
    max-width: 20ch;
}

.hero-title-line {
    display: block;
    opacity: 0;
    transform: translateY(24px);
    animation: heroIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-title-line:nth-child(1) { animation-delay: 0.2s; }
.hero-title-line:nth-child(2) { animation-delay: 0.4s; }
.hero-title-line:nth-child(3) { animation-delay: 0.6s; }

.hero-title-accent {
    color: rgba(var(--purple-3), 1);
    position: relative;
    display: inline-block;
}

/* A soft painted highlight under the middle line — evokes a marker
   stroke, accentuates the most important phrase without falling into
   the overused gradient-text trope. */
.hero-title-accent::before {
    content: '';
    position: absolute;
    left: -2%;
    right: -2%;
    bottom: 0.1em;
    height: 0.4em;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(var(--purple-1), 0.3) 15%,
        rgba(var(--purple-1), 0.3) 85%,
        transparent 100%);
    z-index: -1;
    border-radius: 4px;
    filter: blur(6px);
    transform: scaleX(0);
    transform-origin: left center;
    animation: markerIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.9s forwards;
}

@keyframes markerIn {
    to { transform: scaleX(1); }
}

/* ─── Sub-copy ────────────────────────────────────────────────── */
.hero-sub {
    font-size: clamp(0.9375rem, 2.4vw, 1.125rem);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.7);
    max-width: 34ch;
    margin: 0 0 2.25rem;
    opacity: 0;
    transform: translateY(16px);
    animation: heroIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.8s forwards;
}

.hero-sub strong {
    color: #ffffff;
    font-weight: 600;
}

/* ─── CTAs ────────────────────────────────────────────────────── */
.hero-ctas {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(16px);
    animation: heroIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.95s forwards;
    width: 100%;
    max-width: 520px;
}

/* Install pill — glass surface, mono command, copy button */
.hero-install {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.55rem 0.5rem 1rem;
    background: rgba(16, 16, 24, 0.7);
    border: 1px solid rgba(var(--purple-1), 0.35);
    border-radius: 999px;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow:
        0 10px 40px rgba(var(--purple-1), 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transition: border-color 250ms ease, box-shadow 250ms ease;
}

.hero-install:hover {
    border-color: rgba(var(--purple-1), 0.55);
    box-shadow:
        0 14px 50px rgba(var(--purple-1), 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.hero-install-cmd {
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 0.8125rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
}

.hero-install-cmd .prompt {
    color: rgba(var(--purple-3), 1);
    user-select: none;
    margin-right: 0.5rem;
}

.hero-install-copy {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(var(--purple-1), 0.22);
    border: none;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease;
}

.hero-install-copy:hover  { background: rgba(var(--purple-1), 0.4); }
.hero-install-copy:active { transform: scale(0.92); }
.hero-install-copy svg    { width: 15px; height: 15px; }
.hero-install-copy.copied { background: rgba(16, 185, 129, 0.45); }

/* HA button — solid purple with HA house icon */
.hero-ha {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg,
        rgba(var(--purple-1), 1),
        rgba(var(--purple-2), 1));
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-family: 'Satoshi', 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow:
        0 10px 30px rgba(var(--purple-1), 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: transform 200ms ease, box-shadow 200ms ease;
    position: relative;
    overflow: hidden;
}

/* Shimmer sweep across the HA button on hover — signature SaaS detail */
.hero-ha::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 100%);
    transition: left 600ms ease;
}

.hero-ha:hover {
    transform: translateY(-2px);
    box-shadow:
        0 16px 40px rgba(var(--purple-1), 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.hero-ha:hover::before { left: 100%; }
.hero-ha:active        { transform: translateY(0); }
.hero-ha svg           { width: 18px; height: 18px; }

/* ─── Trust bar ──────────────────────────────────────────────── */
.hero-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem 1rem;
    padding: 0.875rem 1.25rem;
    background: rgba(16, 16, 24, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(16px);
    animation: heroIn 1s cubic-bezier(0.22, 1, 0.36, 1) 1.1s forwards;
}

.hero-trust-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.hero-trust-num {
    color: rgba(var(--purple-3), 1);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
    letter-spacing: 0;
}

.hero-trust-sep {
    color: rgba(255, 255, 255, 0.15);
    user-select: none;
}

/* ─── Floating probe cards (desktop decoration) ───────────────
   Both floating cards hidden on phones — the hero is already dense
   on a narrow screen, and a leaked aside underneath would read as
   loose text instead of a framed peek. The desktop breakpoint below
   re-enables them with their real layout.                          */
.hero-peek,
.hero-peek-sub {
    display: none;
}

/* ─── Entrance keyframes ─────────────────────────────────────── */
@keyframes heroIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────
   TABLET — 640px+
   ───────────────────────────────────────────────────────────── */
@media (min-width: 640px) {
    .hero { padding: 8rem 2rem 4rem; }

    .hero-ctas {
        flex-direction: row;
        justify-content: center;
        max-width: none;
    }

    .hero-install { width: auto; min-width: 360px; }
    .hero-ha      { width: auto; }

    .hero-install-cmd { font-size: 0.875rem; }

    .hero-trust { font-size: 0.75rem; }
    .hero-trust-num { font-size: 0.875rem; }
}

/* ─────────────────────────────────────────────────────────────
   DESKTOP — 960px+
   Reveals the floating terminal peek card.
   ───────────────────────────────────────────────────────────── */
@media (min-width: 960px) {
    .hero { padding: 9rem 2rem 5rem; min-height: 110vh; }

    .hero-title  { max-width: none; }

    .hero-peek {
        display: block;
        position: absolute;
        top: 12%;
        right: 4%;
        width: 280px;
        padding: 0.875rem 1rem;
        background: rgba(16, 16, 24, 0.75);
        border: 1px solid rgba(var(--purple-1), 0.3);
        border-radius: 12px;
        backdrop-filter: blur(18px) saturate(140%);
        -webkit-backdrop-filter: blur(18px) saturate(140%);
        font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
        font-size: 0.75rem;
        color: rgba(255, 255, 255, 0.85);
        box-shadow:
            0 20px 50px rgba(0, 0, 0, 0.4),
            0 10px 30px rgba(var(--purple-1), 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.04) inset;
        opacity: 0;
        /* One-shot entrance only — card drifts in from above with a
           slight scale and rotation, lands in place, and stays
           perfectly still afterwards. No idle floating loop. */
        transform: translateY(-30px) rotate(4deg) scale(0.94);
        filter: blur(6px);
        /* Delayed until ~4s after load so the user finishes reading
           the headline before the cards take over attention. */
        animation: peekIn 1.1s cubic-bezier(0.22, 1, 0.36, 1) 4s forwards;
        z-index: 2;
    }

    @keyframes peekIn {
        to {
            opacity: 1;
            transform: translateY(0) rotate(2deg) scale(1);
            filter: blur(0);
        }
    }

    .hero-peek-head {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        margin-bottom: 0.625rem;
        padding-bottom: 0.625rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.5);
        font-size: 0.65rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    .hero-peek-head-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #10b981;
        box-shadow: 0 0 8px #10b981;
        animation: eyebrowPulse 1.4s ease-in-out infinite;
    }

    .hero-peek-lines {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        line-height: 1.45;
    }

    .hero-peek-line {
        opacity: 0;
        animation: peekLineIn 0.5s ease-out forwards;
    }

    /* Probe lines print between the first card's entrance (4s) and
       the second card's arrival (6s). Five lines across ~1.8s feels
       like a live scan that finishes just as the result pops in. */
    .hero-peek-line:nth-child(1) { animation-delay: 4.3s; }
    .hero-peek-line:nth-child(2) { animation-delay: 4.7s; }
    .hero-peek-line:nth-child(3) { animation-delay: 5.1s; }
    .hero-peek-line:nth-child(4) { animation-delay: 5.5s; }
    .hero-peek-line:nth-child(5) { animation-delay: 5.9s; }

    @keyframes peekLineIn {
        from { opacity: 0; transform: translateX(-8px); }
        to   { opacity: 1; transform: translateX(0); }
    }

    .hero-peek-arrow  { color: rgba(var(--purple-3), 1); user-select: none; }
    .hero-peek-key    { color: rgba(var(--purple-3), 1); }
    .hero-peek-value  { color: #ffffff; }
    .hero-peek-ok     { color: #10b981; }

    /* Second floating card, bottom-left, with a quick result summary */
    .hero-peek-sub {
        display: block;
        position: absolute;
        bottom: calc(14% + 50px);
        left: 4%;
        padding: 0.75rem 0.9rem;
        background: rgba(16, 16, 24, 0.7);
        border: 1px solid rgba(var(--purple-1), 0.25);
        border-radius: 12px;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        font-family: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
        font-size: 0.7rem;
        color: rgba(255, 255, 255, 0.75);
        box-shadow:
            0 14px 40px rgba(0, 0, 0, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.04) inset;
        opacity: 0;
        transform: translateY(30px) rotate(-4deg) scale(0.94);
        filter: blur(6px);
        /* Second card lands at 6s — gives the probe terminal a
           full two seconds to "run" before the result appears. */
        animation: peekInB 1.1s cubic-bezier(0.22, 1, 0.36, 1) 6s forwards;
        z-index: 2;
    }

    @keyframes peekInB {
        to {
            opacity: 1;
            transform: translateY(0) rotate(-2.5deg) scale(1);
            filter: blur(0);
        }
    }

    .hero-peek-sub-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.3rem;
    }
    .hero-peek-sub-row:last-child { margin-bottom: 0; }

    .hero-peek-badge {
        padding: 0.125rem 0.4rem;
        border-radius: 4px;
        font-size: 0.6rem;
        font-weight: 600;
        letter-spacing: 0.08em;
    }
    .hero-peek-badge.alive  { background: rgba(16, 185, 129, 0.2); color: #10b981; }
    .hero-peek-badge.main   { background: rgba(var(--purple-1), 0.3); color: rgba(var(--purple-3), 1); }

    .hero-peek-sub-label { color: rgba(255, 255, 255, 0.5); }
    .hero-peek-sub-value { color: #ffffff; font-weight: 500; }
}

/* Honour users who asked for less motion — we drop the continuous
   idle floating, but entrance animations still play once so the
   layout doesn't arrive empty. */
@media (prefers-reduced-motion: reduce) {
    .hero-peek,
    .hero-peek-sub,
    .hero-eyebrow-dot,
    .hero-peek-head-dot {
        animation: none !important;
    }
}
