/* =====================================================================
   uDesk landing — new sections: feature card grid, integrations marquee,
   tabbed feature showcase. Colors reuse existing design-system tokens
   (brand ramp + accents already defined in landing.css / app.css).
   ===================================================================== */

/* Shared centered header helpers reuse .section-head / .eyebrow from landing.css */
.grad-teal {
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============================ TASK 2 — FEATURE CARD GRID ============================ */
.feature-grid-section {
    background: var(--bg);
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--brand-soft);
    color: var(--brand-700);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}

html[data-theme='dark'] .badge-pill {
    background: #134e4a;
    color: #99f6e4;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch;
}

.fcard {
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme='dark'] .fcard {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
}

.fcard:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1), 0 12px 32px rgba(0, 0, 0, 0.06);
}

.fcard-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.fcard-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.fcard-cat {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--brand-700);
    background: var(--brand-soft);
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

html[data-theme='dark'] .fcard-cat {
    background: #134e4a;
    color: #99f6e4;
}

.fcard-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: 0.01em;
    margin-bottom: 9px;
    line-height: 1.15;
}

.fcard-desc {
    font-size: 0.9rem;
    color: var(--fg-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
}

.fcard-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fcard-tag {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--fg);
    border: 1px solid var(--border);
    background: transparent;
    padding: 5px 11px;
    border-radius: 999px;
}

/* Icon color rotation — all tokens already in the design system */
.ic-teal { background: var(--midnight); }
.ic-brand { background: var(--brand-600); }
.ic-glow { background: var(--brand-500); }
.ic-indigo { background: #4f46e5; }
.ic-orange { background: #ea580c; }
.ic-amber { background: #f59e0b; }
.ic-green { background: #16a34a; }
.ic-navy { background: #1a3358; }

html[data-theme='dark'] .ic-teal { background: var(--brand-600); }

/* ============================ TASK 3 — INTEGRATIONS MARQUEE ============================ */
.marquee-section {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.eyebrow-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--brand-500);
    border-radius: 50%;
    margin-right: 2px;
}

.marquee-ai-line {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--brand-700);
    font-weight: 500;
    margin-top: 10px;
}

html[data-theme='dark'] .marquee-ai-line {
    color: var(--brand-400);
}

.marquee {
    position: relative;
    width: 100%;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee + .marquee {
    margin-top: 16px;
}

.marquee-track {
    display: flex;
    gap: 16px;
    width: max-content;
    will-change: transform;
}

.logo-card {
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
    padding: 16px;
    width: 168px;
    height: 80px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

html[data-theme='dark'] .logo-card {
    border: 1px solid var(--border);
}

.logo-mono {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.logo-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

/* Line 1 — partner name (bold, larger). Line 2 — category (muted, smaller). */
.logo-name {
    display: block;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-kind {
    display: block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================ TASK 1 — TABBED SHOWCASE ============================ */
.showcase-section {
    background: var(--bg);
}

.tabs-row {
    display: flex;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    max-width: 860px;
    margin: 0 auto 44px;
    box-shadow: var(--shadow-sm);
}

.tab {
    --acc: var(--midnight);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 16px;
    border-radius: 11px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    color: var(--fg-muted);
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.tab:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

.tab .tab-ico {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    color: var(--fg-muted);
    flex-shrink: 0;
    transition: background 0.18s ease, color 0.18s ease;
}

.tab .tab-num {
    font-family: var(--font-label);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--fg-muted);
    display: block;
    line-height: 1;
    margin-bottom: 3px;
}

.tab .tab-label {
    font-family: var(--font-head);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.05;
    display: block;
}

.tab[aria-selected='true'] {
    background: color-mix(in srgb, var(--acc) 12%, var(--card));
    color: var(--fg);
}

/* Auto-advance progress indicator (Task 3) */
.tab-progress {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 5px;
    height: 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--acc) 22%, transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
    overflow: hidden;
}

.tab[aria-selected='true'] .tab-progress {
    opacity: 1;
}

.tab-progress-fill {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: var(--acc);
    transform: scaleX(0);
    transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
    /* No auto-advance / progress for reduced-motion users — manual tabs only. */
    .tab-progress {
        display: none;
    }
}

.tab[aria-selected='true'] .tab-ico {
    background: var(--acc);
    color: #fff;
}

.tab[aria-selected='true'] .tab-num {
    color: var(--acc);
}

.tabpanels {
    position: relative;
}

.tabpanel {
    display: none;
}

.tabpanel.active {
    display: block;
}

@media (prefers-reduced-motion: no-preference) {
    .tabpanel.active {
        animation: tab-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }

    @keyframes tab-in {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: none; }
    }
}

.tabpanel-head {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 34px;
}

.tabpanel-head h3 {
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    letter-spacing: 0.01em;
    margin-bottom: 12px;
}

.tabpanel-head p {
    color: var(--fg-muted);
    font-size: 1.02rem;
}

/* Layout A — big app screenshot frame */
.layouta-frame {
    max-width: 940px;
    margin: 0 auto;
}

/* Layout B — split feature list + device */
.layoutb {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
}

.layoutb-list {
    display: grid;
    gap: 14px;
}

.lb-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 14px 16px;
}

.lb-row .lb-ico {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.lb-row .lb-name {
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--fg);
    font-size: 0.96rem;
    margin-bottom: 2px;
}

.lb-row .lb-desc {
    font-family: var(--font-body);
    font-size: 0.86rem;
    color: var(--fg-muted);
    line-height: 1.55;
}

/* Layout C — 3 card row */
.layoutc {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch;
}

.layoutc-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.layoutc-card .lc-ico {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 16px;
}

.layoutc-card h4 {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--fg);
    margin-bottom: 9px;
}

.layoutc-card p {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--fg-muted);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 18px;
}

.lc-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--acc, var(--brand-700));
}

.lc-stat svg {
    flex-shrink: 0;
}

/* Device / phone frame for Layout B (widget) */
.device {
    max-width: 320px;
    margin-inline: auto;
    background: #0b1220;
    border-radius: 34px;
    padding: 12px;
    box-shadow: var(--shadow-lg);
}

.device-screen {
    border-radius: 24px;
    overflow: hidden;
    background: var(--card);
}

/* ============================ TASK 1 — TRY-IT-YOURSELF DEMO PANEL ============================ */
.demo-section {
    background: var(--bg-alt);
}

.demo-panel {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 0;
    max-width: 960px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.demo-col {
    padding: 30px 32px;
    display: flex;
    flex-direction: column;
}

.demo-sandbox {
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--brand-500) 5%, var(--card));
}

.demo-tag {
    align-self: flex-start;
    font-family: var(--font-label);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-700);
    background: var(--brand-soft);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}

html[data-theme='dark'] .demo-tag {
    background: #134e4a;
    color: #99f6e4;
}

.demo-col h3 {
    font-size: 1.25rem;
    letter-spacing: 0.01em;
    color: var(--fg);
    margin-bottom: 6px;
}

.demo-col-sub {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--fg-muted);
    line-height: 1.55;
    margin-bottom: 18px;
}

.demo-frame {
    position: relative;
    flex: 1;
    min-height: 210px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
}

.demo-frame iframe {
    width: 100%;
    height: 100%;
    min-height: 210px;
    border: 0;
    display: block;
}

.demo-frame-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 20px;
    color: var(--fg-muted);
    background:
        repeating-linear-gradient(45deg, transparent 0 12px, color-mix(in srgb, var(--brand-500) 5%, transparent) 12px 24px);
}

.demo-status-title {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--fg);
    letter-spacing: 0.01em;
}

.demo-frame-placeholder small {
    font-family: var(--font-body);
    font-size: 0.78rem;
    max-width: 240px;
}

.demo-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--brand-500);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-500) 60%, transparent);
    margin-bottom: 4px;
}

.demo-creds-col {
    justify-content: flex-start;
}

.demo-reveal {
    align-self: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.demo-creds {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.demo-creds[hidden] {
    display: none;
}

.demo-cred {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px;
}

.demo-cred-label {
    font-family: var(--font-label);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fg-muted);
    width: 66px;
    flex-shrink: 0;
}

.demo-cred code {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.demo-copy {
    flex-shrink: 0;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--brand-700);
    background: var(--brand-soft);
    border: none;
    border-radius: 7px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.demo-copy:hover {
    background: color-mix(in srgb, var(--brand-500) 22%, transparent);
}

html[data-theme='dark'] .demo-copy {
    background: #134e4a;
    color: #99f6e4;
}

.demo-launch {
    align-self: flex-start;
    gap: 8px;
}

.demo-launch[aria-disabled='true'] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.demo-disclaimer {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--fg-muted);
    margin-top: 14px;
}

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

    .demo-panel {
        grid-template-columns: 1fr;
    }

    .demo-sandbox {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

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

    .layoutb {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .tabs-row {
        flex-wrap: wrap;
    }

    .tab {
        flex: 1 1 calc(50% - 5px);
    }
}

@media (max-width: 639px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .tab {
        flex: 1 1 100%;
    }

    .logo-card {
        width: 150px;
        height: 64px;
        padding: 12px;
    }

    .logo-mono {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

/* ============================ MARQUEE ANIMATION (motion-safe only) ============================ */
@media (prefers-reduced-motion: no-preference) {
    .marquee-track.to-left {
        animation: marquee-left 35s linear infinite;
    }

    .marquee-track.to-right {
        animation: marquee-right 45s linear infinite;
    }

    .marquee:hover .marquee-track {
        animation-play-state: paused;
    }

    @keyframes marquee-left {
        from { transform: translateX(0); }
        to { transform: translateX(-50%); }
    }

    @keyframes marquee-right {
        from { transform: translateX(-50%); }
        to { transform: translateX(0); }
    }
}

/* ============================ TASK 5 — MOCKUP MICRO-ANIMATIONS ============================
   These are the interim treatment layered on the HTML/CSS product mockups until real
   screen-recordings can be captured from a running instance. Every animation is:
     - gated behind prefers-reduced-motion: no-preference (static fallback otherwise), and
     - only active while the mock carries .playing (added by the in-view observer in landing.js),
       so nothing animates off-screen.
   ============================================================================================ */
.demo-live-dot {
    /* subtle "live" ping on the demo sandbox placeholder */
    animation: none;
}

@media (prefers-reduced-motion: no-preference) {
    .demo-live-dot {
        animation: live-ping 2.2s ease-out infinite;
    }

    @keyframes live-ping {
        0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-500) 55%, transparent); }
        70%, 100% { box-shadow: 0 0 0 9px transparent; }
    }

    /* Ticket composer — blinking type caret (simulated typing) */
    .mock-ticket.playing .mt-composer .ph {
        position: relative;
    }

    .mock-ticket.playing .mt-composer .ph::after {
        content: '';
        display: inline-block;
        width: 2px;
        height: 1em;
        margin-left: 3px;
        vertical-align: -2px;
        background: var(--brand-600);
        animation: demo-caret 1.05s steps(1) infinite;
    }

    @keyframes demo-caret {
        0%, 50% { opacity: 1; }
        50.01%, 100% { opacity: 0; }
    }

    /* Live-chat widget — pre-chat topic chips tapped in sequence */
    .mock-widget.playing .wg-chip {
        animation: chip-tap 4.5s ease-in-out infinite;
    }

    .mock-widget.playing .wg-chip:nth-child(2) { animation-delay: 1.5s; }
    .mock-widget.playing .wg-chip:nth-child(3) { animation-delay: 3s; }

    @keyframes chip-tap {
        0%, 14%, 100% { transform: none; box-shadow: none; }
        4% { transform: scale(0.93); }
        8% {
            transform: scale(1.03);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 26%, transparent);
        }
    }

    /* Workflow builder — nodes light up trigger → condition → action */
    .mock-wf.playing .wf-node {
        animation: node-pulse 4.5s ease-in-out infinite;
    }

    .mock-wf.playing .wf-node:nth-child(3) { animation-delay: 0.8s; }
    .mock-wf.playing .wf-node:nth-child(5) { animation-delay: 1.6s; }

    /* Reports — metric icons pulse in a gentle stagger */
    .layoutc.playing .lc-ico {
        animation: node-pulse 4s ease-in-out infinite;
    }

    .layoutc.playing .layoutc-card:nth-child(2) .lc-ico { animation-delay: 0.6s; }
    .layoutc.playing .layoutc-card:nth-child(3) .lc-ico { animation-delay: 1.2s; }

    @keyframes node-pulse {
        0%, 40%, 100% { box-shadow: 0 0 0 0 transparent; }
        10% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand-500) 22%, transparent); }
    }
}
