/* ============================================================
   Agentic Discovery — tab-driven live-demo section
   Vanilla port of claude.ai/design "Agentic Discovery.html"
   ============================================================ */

.ad-section {
    --ad-cyan: #2BA89E;
    --ad-purple: #B7A4F0;
    --ad-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
    --ad-display: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
    --ad-ease: cubic-bezier(0.4, 0, 0.2, 1);
    background: #000000;
    color: #FFFFFF;
    padding: 96px 0 112px;
    position: relative;
}

.ad-section__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
}

.ad-section__head {
    margin-bottom: 2.5rem;
}

.ad-section__label {
    font-family: var(--ad-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 1.25rem;
    display: block;
}

.ad-section__headline {
    font-family: var(--ad-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 300;
    color: #FFFFFF;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 1rem 0;
    max-width: 820px;
    position: relative;
    display: inline-block;
}

.ad-section__headline::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--neural-purple, #3c1361), var(--neural-orange, #d97706));
    margin-top: 0.875rem;
}

.ad-section__sub {
    font-family: var(--ad-display);
    font-size: 1rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.7);
    max-width: 720px;
    margin: 1rem 0 0;
}

/* ============================================================
   Sticky stage — only the demo widget latches under the header.
   The headline above scrolls away normally; the widget pins at
   header_height + 20px and stays put for ~half a viewport of
   scroll travel, then un-sticks naturally.
   ============================================================ */
.ad-stage {
    position: relative;
}

.ad-stage__inner {
    position: sticky;
    top: calc(var(--header-height, 90px) + 20px);
}

.ad-stage::after {
    content: '';
    display: block;
    height: 50vh;
}

/* ============================================================
   Outer card
   ============================================================ */
.ad-shell {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(43, 168, 158, 0.35);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(43, 168, 158, 0.08),
        0 0 24px rgba(43, 168, 158, 0.18),
        0 0 64px rgba(43, 168, 158, 0.12),
        0 24px 64px rgba(0, 0, 0, 0.4);
}

.ad-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ad-head__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--ad-mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.ad-head__title-dot {
    width: 6px;
    height: 6px;
    background: var(--ad-cyan);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--ad-cyan);
}

.ad-head__spacer { flex: 1; }

.ad-head__rec {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--ad-mono);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 1px;
}

.ad-head__rec-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #DC2626;
    animation: ad-rec 2s ease-in-out infinite;
}

@keyframes ad-rec {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ============================================================
   Body — chat thread
   ============================================================ */
.ad-thread {
    height: 520px;
    overflow: hidden;
    position: relative;
    padding: 24px 32px 8px;
}

.ad-thread__scroll {
    height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.ad-thread__scroll::-webkit-scrollbar { width: 6px; }
.ad-thread__scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.ad-msg {
    display: flex;
    gap: 12px;
}

.ad-msg__avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.02);
}

.ad-msg__avatar--user {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
}

.ad-msg__avatar--agent {
    border-color: rgba(43, 168, 158, 0.5);
    background: rgba(43, 168, 158, 0.06);
    color: var(--ad-cyan);
}

.ad-msg__body {
    flex: 1;
    min-width: 0;
}

.ad-msg__role {
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 4px;
}

.ad-msg__role--agent { color: var(--ad-cyan); }

.ad-msg__text {
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: -0.1px;
    max-width: 720px;
}

.ad-msg__cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--ad-cyan);
    margin-left: 3px;
    vertical-align: text-bottom;
    animation: ad-blink 0.7s infinite;
}

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

/* Tool call cards */
.ad-tool {
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.015);
    overflow: hidden;
    max-width: 720px;
}

.ad-tool__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: var(--ad-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
}

.ad-tool__head-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-tool__head-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--ad-cyan);
    fill: none;
    stroke-width: 1.5;
}

.ad-tool__head strong {
    color: #FFFFFF;
    font-weight: 500;
}

.ad-tool__head-meta {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
}

.ad-tool__head-status {
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(43, 168, 158, 0.1);
    color: var(--ad-cyan);
    border: 1px solid rgba(43, 168, 158, 0.3);
}

.ad-tool__head-status--pending {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.15);
}

.ad-tool__head-status--pending::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    border: 1px solid currentColor;
    border-top-color: transparent;
    animation: ad-spin 0.7s linear infinite;
    margin-right: 5px;
    vertical-align: 1px;
}

@keyframes ad-spin { to { transform: rotate(360deg); } }

.ad-tool__body {
    padding: 8px 14px 14px;
}

/* Source list */
.ad-sources {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ad-source {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-family: var(--ad-mono);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
    opacity: 0;
    transition: opacity 0.5s var(--ad-ease),
                transform 0.5s var(--ad-ease),
                max-height 0.5s var(--ad-ease),
                padding 0.5s var(--ad-ease),
                margin 0.5s var(--ad-ease),
                border 0.5s var(--ad-ease);
    overflow: hidden;
}

.ad-source.is-visible { opacity: 1; }

.ad-source--dimmed {
    opacity: 0;
    transform: translateX(-12px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: -6px;
    border-color: transparent;
}

.ad-source--match {
    border-color: rgba(43, 168, 158, 0.4);
    background: rgba(43, 168, 158, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.ad-source__num {
    font-family: var(--ad-mono);
    color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    text-align: right;
}

.ad-source--match .ad-source__num { color: var(--ad-cyan); }

.ad-source__url {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-source__url em {
    font-style: normal;
    color: rgba(255, 255, 255, 0.4);
}

.ad-source--match .ad-source__url em {
    color: var(--ad-cyan);
    opacity: 0.7;
}

.ad-source__tag {
    font-size: 9px;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
}

.ad-source__tag--llms {
    border-color: var(--ad-cyan);
    color: var(--ad-cyan);
    background: rgba(43, 168, 158, 0.06);
}

/* llms.txt preview */
.ad-llms {
    margin-top: 10px;
    border: 1px dashed rgba(43, 168, 158, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 14px;
    font-family: var(--ad-mono);
    font-size: 11px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.65);
    overflow: hidden;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    transition: max-height 0.5s var(--ad-ease) 0.3s,
                padding 0.5s var(--ad-ease) 0.3s,
                border-width 0.5s var(--ad-ease) 0.3s,
                margin 0.5s var(--ad-ease) 0.3s;
}

.ad-llms.is-show {
    max-height: 200px;
    padding-top: 12px;
    padding-bottom: 12px;
    border-width: 1px;
}

.ad-llms__head {
    color: var(--ad-cyan);
    font-size: 10px;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-llms__head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(43, 168, 158, 0.2);
}

.ad-llms code {
    display: block;
    white-space: pre;
}

.ad-llms .ad-c-key { color: var(--ad-cyan); }
.ad-llms .ad-c-str { color: rgba(255, 255, 255, 0.85); }
.ad-llms .ad-c-com { color: rgba(255, 255, 255, 0.3); font-style: italic; }
.ad-llms .ad-c-hl { background: rgba(43, 168, 158, 0.15); padding: 1px 4px; border-radius: 3px; }

/* JSON response panel */
.ad-json {
    font-family: var(--ad-mono);
    font-size: 11px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    padding: 12px 16px;
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.ad-json::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.4));
    pointer-events: none;
}

.ad-json__line { white-space: pre; }
.ad-json .ad-c-key { color: var(--ad-purple); }
.ad-json .ad-c-str { color: var(--ad-cyan); }
.ad-json .ad-c-num { color: rgba(255, 255, 255, 0.85); }

/* GET response status row */
.ad-resp {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(43, 168, 158, 0.04);
    border: 1px solid rgba(43, 168, 158, 0.18);
    font-family: var(--ad-mono);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 10px;
}

.ad-resp__status {
    color: var(--ad-cyan);
    letter-spacing: 1px;
}

.ad-resp__method {
    color: var(--ad-purple);
    font-weight: 500;
}

.ad-resp__url {
    color: rgba(255, 255, 255, 0.65);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-resp__meta {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
}

/* Product cards */
.ad-products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 14px;
    max-width: 720px;
}

.ad-product {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ad-product__img {
    aspect-ratio: 1 / 1;
    background: #1a1a1a;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-product__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ad-product__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-family: var(--ad-mono);
    font-size: 9px;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--ad-cyan);
    border: 1px solid rgba(43, 168, 158, 0.4);
}

.ad-product__body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ad-product__title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: -0.1px;
}

.ad-product__sub {
    font-family: var(--ad-mono);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.5px;
}

.ad-product__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 4px;
}

.ad-product__price {
    font-family: var(--ad-display);
    font-weight: 300;
    font-size: 18px;
    color: #FFFFFF;
    letter-spacing: -0.4px;
}

.ad-product__cta {
    font-family: var(--ad-mono);
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--ad-cyan);
}

/* ============================================================
   Tabs footer
   ============================================================ */
.ad-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ad-tab {
    padding: 18px 20px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    background: transparent;
    border-top: none;
    border-bottom: none;
    border-left: none;
    text-align: left;
    font-family: var(--ad-display);
    color: inherit;
    transition: background 0.2s;
}

.ad-tab:last-child { border-right: none; }
.ad-tab:hover { background: rgba(255, 255, 255, 0.02); }
.ad-tab--active { background: rgba(43, 168, 158, 0.04); }

.ad-tab__progress {
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}

.ad-tab__progress-fill {
    position: absolute;
    inset: 0;
    background: var(--ad-cyan);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

.ad-tab--active .ad-tab__progress { background: rgba(43, 168, 158, 0.15); }
.ad-tab--done .ad-tab__progress-fill {
    transform: scaleX(1);
    background: rgba(43, 168, 158, 0.4);
    transition: none;
}

.ad-tab__row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.ad-tab__num {
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
}

.ad-tab--active .ad-tab__num { color: var(--ad-cyan); }
.ad-tab--done .ad-tab__num { color: rgba(43, 168, 158, 0.6); }

.ad-tab__title {
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.ad-tab--active .ad-tab__title { color: #FFFFFF; }

.ad-tab__desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.4;
    letter-spacing: -0.1px;
}

.ad-tab--active .ad-tab__desc { color: rgba(255, 255, 255, 0.7); }

/* ============================================================
   Replay overlay (10s hold)
   ============================================================ */
.ad-hold {
    position: absolute;
    bottom: 100px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s, transform 0.3s;
}

.ad-hold.is-show {
    opacity: 1;
    transform: translateY(0);
}

.ad-hold__ring {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    position: relative;
}

.ad-hold__ring svg {
    position: absolute;
    inset: -1.5px;
    transform: rotate(-90deg);
}

.ad-hold__ring circle {
    fill: none;
    stroke: var(--ad-cyan);
    stroke-width: 1.5;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 880px) {
    .ad-section { padding: 64px 0 80px; }
    .ad-section__container { padding: 0 1.5rem; }
    .ad-thread { height: 500px; padding: 16px; }
    .ad-products { grid-template-columns: 1fr; }
    .ad-tabs { grid-template-columns: 1fr 1fr; }
    .ad-tab__desc { display: none; }
    .ad-stage__inner { position: relative; top: 0; } /* drop sticky on mobile */
}

@media (prefers-reduced-motion: reduce) {
    .ad-msg__cursor,
    .ad-head__rec-dot { animation: none; }
}
