/* BunnyQuery product section: the hero of web-bunnyquery's landing page
   (src/views/landing.vue, components/bunnyLoader.vue), ported to plain CSS.
   Every rule is scoped under .p-bunnyquery; the --bq-* tokens are the light
   theme of src/assets/less/bq-tokens.less, defined on the section itself.
   Keyframes are prefixed pbq-. Sizes are in px (1rem = 16px in the original)
   so the host page's root font size does not rescale the section.

   Needs IBM Plex Mono, loaded in the page <head>:
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap"> */

/* ─── tokens + section base ─── */
.p-bunnyquery {
    --bq-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --bq-ink: #111;
    --bq-paper: #fff;
    --bq-muted: #666;
    --bq-line: #c8c8c8;
    --bq-pink: #c2185b;
    --bq-pink-bg: #fff8fa;
    --bq-success: #2a7d29;
    --bq-success-bg: #eef9f0;
    --bq-success-border: #b8dcbc;
    --bq-warning: #8a6d00;
    --bq-warning-bg: #fff8e1;
    --bq-warning-border: #e2a300;
    --bq-shadow: rgba(0, 0, 0, 0.12);
    --bq-text-shadow: 2px 2px rgba(0, 0, 0, 0.12);
    --bq-alt-bg: #fafafa;

    position: relative;
    isolation: isolate;
    /* the dashed plate behind the chat window reaches past the gutter */
    overflow: hidden;
    overflow: clip;
    margin: 0;
    padding: 64px 0 72px;
    border-bottom: 1px solid var(--bq-line);
    background: var(--bq-paper);
    /* the page shell's base text (body + .bq-landing in the original) */
    color: var(--bq-ink);
    font-family: var(--bq-mono);
    font-size: 16px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.7;
    letter-spacing: -0.3px;
    text-align: left;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light;
}

.p-bunnyquery,
.p-bunnyquery *,
.p-bunnyquery *::before,
.p-bunnyquery *::after {
    box-sizing: border-box;
}

.p-bunnyquery p {
    line-height: 1.5;
}

.p-bunnyquery a {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    cursor: pointer;
}

.p-bunnyquery svg {
    vertical-align: middle;
}

/* The glyph field sits behind the content, strongest in the top right corner
   behind the chat window and gone before it reaches the copy. */
.p-bunnyquery::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: var(--bq-line);
    -webkit-mask-image: radial-gradient(110% 120% at 100% 0%, #000 25%, transparent 72%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 16h8l5 5v13H20zM28 16v5h5'/%3E%3Cpath d='M106 24h18v12h-10l-4 4v-4h-4z'/%3E%3Ccircle cx='52' cy='108' r='6'/%3E%3Cpath d='M56.5 112.5l5 5'/%3E%3Cpath d='M138 104c1 5 3 7 8 8-5 1-7 3-8 8-1-5-3-7-8-8 5-1 7-3 8-8z'/%3E%3C/svg%3E");
    mask-image: radial-gradient(110% 120% at 100% 0%, #000 25%, transparent 72%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 16h8l5 5v13H20zM28 16v5h5'/%3E%3Cpath d='M106 24h18v12h-10l-4 4v-4h-4z'/%3E%3Ccircle cx='52' cy='108' r='6'/%3E%3Cpath d='M56.5 112.5l5 5'/%3E%3Cpath d='M138 104c1 5 3 7 8 8-5 1-7 3-8 8-1-5-3-7-8-8 5-1 7-3 8-8z'/%3E%3C/svg%3E");
    -webkit-mask-size: 100% 100%, 180px 180px;
    mask-size: 100% 100%, 180px 180px;
    -webkit-mask-repeat: no-repeat, repeat;
    mask-repeat: no-repeat, repeat;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

.p-bunnyquery .wordset {
    display: inline-block;
}

.p-bunnyquery .bq-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ─── button ─── */
.p-bunnyquery .bq-btn {
    display: inline-block;
    padding: 14.4px 28px;
    border: 1px solid var(--bq-ink);
    background: var(--bq-ink);
    color: var(--bq-paper);
    font: inherit;
    font-size: 14.72px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 2px 2px var(--bq-shadow);
}

.p-bunnyquery .bq-btn:hover {
    text-decoration: none;
}

/* Extrude on hover only where hover is a real pointer state (a tap would
   leave it stuck raised). */
@media (hover: hover) and (pointer: fine) {
    .p-bunnyquery .bq-btn:hover {
        transform: translate(-1px, -1px);
        box-shadow: 3px 3px var(--bq-shadow);
    }
}

.p-bunnyquery .bq-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
    transition-duration: 0.04s;
}

/* ─── hero copy ─── */
.p-bunnyquery .bq-hero-title {
    margin: 0;
    font-size: clamp(43.2px, 5.4vw, 73.6px);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: var(--bq-text-shadow);
}

.p-bunnyquery .bq-hero-grid {
    display: grid;
    /* minmax(0, ...) so neither column can be widened by its content */
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
    gap: 56px;
    align-items: center;
}

.p-bunnyquery .bq-hero-copy {
    min-width: 0;
}

/* The "AI Indexed Data Storage" line inside the title: a line of its own
   under the name, in the brand pink, without the title's shadow. */
.p-bunnyquery .bq-hero-tagline {
    display: block;
    margin: 17.6px 0 0;
    color: var(--bq-pink);
    font-size: clamp(16.8px, 1.7vw, 20.8px);
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0;
    text-shadow: none;
}

.p-bunnyquery .bq-hero-body {
    margin: 28px 0 0;
    color: var(--bq-muted);
}

.p-bunnyquery .bq-hero-line {
    margin: 24px 0 0;
    font-weight: 600;
}

.p-bunnyquery .bq-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 0;
}

.p-bunnyquery .bq-hero-tag {
    padding: 4px 9.6px;
    border: 1px solid var(--bq-line);
    background: var(--bq-paper);
    color: var(--bq-muted);
    font-size: 12.48px;
    white-space: nowrap;
}

.p-bunnyquery .bq-hero-actions {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

/* The widget's npm release under the Try button: small, mono and muted, a
   link that only shows its colour on hover. */
.p-bunnyquery .bq-hero-npm {
    font-family: var(--bq-mono);
    font-size: 12.48px;
    color: var(--bq-muted);
    text-decoration: none;
    white-space: nowrap;
}

.p-bunnyquery .bq-hero-npm:hover {
    color: var(--bq-ink);
    text-decoration: underline;
}

.p-bunnyquery .bq-hero-stage {
    min-width: 0;
}

/* ─── the hopping bunny on the chat window's top edge ───
   Two frames stacked in one box: the standing frame at the bottom, its feet
   on the window's border, and the jumping frame a bunny-height above it, so
   the track is two frames (2 x 3 lines x 1.2) tall. Anchored to the middle of
   the window and hopping --hop either side; --hop is capped so on a narrow
   phone it turns round before the window's edge. */
.p-bunnyquery .bq-hero-landing-bunny {
    position: relative;
    width: 100%;
    --hop: min(21ch, calc(50% - 5ch));
}

.p-bunnyquery .bq-bunny-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.p-bunnyquery .bq-bunny-stage {
    display: inline-block;
    position: relative;
    width: 100%;
    text-align: left;
}

.p-bunnyquery .bq-bunny-track {
    position: relative;
    height: 115.2px;
    width: 100%;
    animation: pbq-hero-bunny-move 9s steps(12) infinite;
}

.p-bunnyquery .bq-bunny-dir {
    display: inline-block;
    position: absolute;
    bottom: 0;
    left: 50%;
    margin-left: -4ch;
    animation: pbq-bunny-flip 9s steps(1) infinite;
}

.p-bunnyquery .bq-frame {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    /* a Latin monospace stack, so the backslash never draws as a won/yen sign */
    font-family: var(--bq-mono);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    white-space: pre;
    color: var(--bq-ink);
}

.p-bunnyquery .bq-frame-a {
    animation: pbq-bunny-toggle-a 1s steps(1) infinite;
}

.p-bunnyquery .bq-frame-b {
    animation: pbq-bunny-toggle-b 1s steps(1) infinite;
    opacity: 0;
}

/* Off screen (bunnyquery.js sets .is-paused): everything that moves holds. */
.p-bunnyquery.is-paused .bq-bunny-track,
.p-bunnyquery.is-paused .bq-bunny-dir,
.p-bunnyquery.is-paused .bq-frame,
.p-bunnyquery.is-paused .bq-demo-caret,
.p-bunnyquery.is-paused .bq-demo-dots::after {
    animation-play-state: paused;
}

@keyframes pbq-hero-bunny-move {
    0%     { transform: translateX(calc(var(--hop) * -1)); }
    25%    { transform: translateX(var(--hop)); }
    37.5%  { transform: translateX(var(--hop)); }
    50%    { transform: translateX(var(--hop)); }
    75%    { transform: translateX(calc(var(--hop) * -1)); }
    87.5%  { transform: translateX(calc(var(--hop) * -1)); }
    100%   { transform: translateX(calc(var(--hop) * -1)); }
}

@keyframes pbq-bunny-flip {
    0%   { transform: scaleX(1); }
    50%  { transform: scaleX(-1); }
}

@keyframes pbq-bunny-toggle-a {
    0%   { opacity: 1; }
    25%  { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes pbq-bunny-toggle-b {
    0%   { opacity: 0; }
    25%  { opacity: 1; }
    100% { opacity: 0; }
}

/* A dashed pink plate behind the chat window, offset like the hard shadows. */
.p-bunnyquery .bq-demo-frame {
    position: relative;
    isolation: isolate;
}

.p-bunnyquery .bq-demo-frame::before {
    content: "";
    position: absolute;
    inset: 14px -14px -14px 14px;
    z-index: -1;
    border: 1px dashed var(--bq-pink);
    pointer-events: none;
}

/* ─── chat demo ─── */
/* A screen, not a client: a title bar and the conversation, nothing else. */
.p-bunnyquery .bq-demo {
    border: 1px solid var(--bq-line);
    background: var(--bq-paper);
    box-shadow: 4px 4px var(--bq-shadow);
    font-size: 14.08px;
}

.p-bunnyquery .bq-demo-bar {
    padding: 8.8px 14.4px;
    border-bottom: 1px solid var(--bq-line);
    color: var(--bq-muted);
    font-size: 12.8px;
}

.p-bunnyquery .bq-demo-bar-title {
    display: inline;
}

.p-bunnyquery .bq-demo-chat {
    display: flex;
    flex-direction: column;
    gap: 14.4px;
    padding: 17.6px;
}

/* The invisible finished conversations reserve the height; the live copy
   plays on top of them, so the window never resizes mid-loop. */
.p-bunnyquery .bq-demo-stage {
    position: relative;
    overflow: hidden;
}

/* Every scenario's finished conversation overlaps in ONE grid cell, so the
   tallest sets the window's height for the whole rotation. */
.p-bunnyquery .bq-demo-chat--sizer {
    visibility: hidden;
    pointer-events: none;
    display: grid;
}

.p-bunnyquery .bq-demo-chat--sizer * {
    animation: none !important;
}

.p-bunnyquery .bq-demo-sizer-copy {
    grid-area: 1 / 1;
    min-width: 0;
}

.p-bunnyquery .bq-demo-chat--live {
    position: absolute;
    inset: 0;
}

/* The folder's row: green once indexed. Always two lines, the folder's name
   over what is happening to it, so the row is one height in both states. */
.p-bunnyquery .bq-demo-note {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    align-self: stretch;
    padding: 7.2px 12.8px;
    border: 1px solid var(--bq-success-border);
    background: var(--bq-success-bg);
    font-size: 12.48px;
}

.p-bunnyquery .bq-demo-note-head {
    display: flex;
    align-items: center;
    min-width: 0;
}

.p-bunnyquery .bq-demo-note-file {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.p-bunnyquery .bq-demo-note-state {
    flex-shrink: 0;
    margin-left: 4.8px;
    color: var(--bq-warning);
    white-space: nowrap;
}

.p-bunnyquery .bq-demo-note .bq-demo-dots,
.p-bunnyquery .bq-demo-folder-icon {
    flex-shrink: 0;
}

/* While the folder is still going up: the working tint, with a progress fill
   behind the text whose width follows --att-progress. */
.p-bunnyquery .bq-demo-note.is-working {
    border-color: var(--bq-warning-border);
    background: var(--bq-warning-bg);
}

.p-bunnyquery .bq-demo-note.is-working::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    z-index: -1;
    width: var(--att-progress, 0%);
    background: color-mix(in srgb, var(--bq-warning-border) 28%, transparent);
    transition: width 0.15s linear;
}

.p-bunnyquery .bq-demo-note-upload,
.p-bunnyquery .bq-demo-note-done {
    margin-top: 2.4px;
    font-size: 11.52px;
}

.p-bunnyquery .bq-demo-note-done {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--bq-success);
}

.p-bunnyquery .bq-demo-note-upload {
    display: flex;
    align-items: baseline;
    gap: 12px;
    color: var(--bq-warning);
}

.p-bunnyquery .bq-demo-note-path {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 0.85;
}

/* figures of one width, so the count does not jitter as it climbs */
.p-bunnyquery .bq-demo-note-count {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.p-bunnyquery .bq-demo-msg {
    display: flex;
    align-items: flex-end;
    gap: 9.6px;
    max-width: 92%;
}

.p-bunnyquery .bq-demo-bubble {
    min-width: 0;
    border: 1px solid var(--bq-line);
    background: var(--bq-paper);
    padding: 10.4px 14.4px;
    line-height: 1.55;
    overflow-x: auto;
    box-shadow: 2px 2px var(--bq-shadow);
}

.p-bunnyquery .bq-demo-msg--user {
    align-self: flex-end;
    max-width: 85%;
}

/* flat like the real user bubbles: the shadow stays on replies only */
.p-bunnyquery .bq-demo-msg--user .bq-demo-bubble {
    background: var(--bq-pink-bg);
    box-shadow: none;
}

/* The question while it is being written: the user's colours, anchored on
   the left so the text runs left to right, and dashed, not yet a message. */
.p-bunnyquery .bq-demo-msg--draft {
    align-self: flex-start;
    max-width: 85%;
}

.p-bunnyquery .bq-demo-msg--draft .bq-demo-bubble {
    border-style: dashed;
    background: var(--bq-pink-bg);
    box-shadow: none;
}

.p-bunnyquery .bq-demo-bubble .bq-demo-bunny {
    display: block;
    width: auto;
    max-width: none;
    height: 2.6em;
    margin: 0;
    border: 0;
}

/* The bunny, with the waiting dots beside it while it thinks. */
.p-bunnyquery .bq-demo-bubble .bq-demo-bubble-head {
    display: flex;
    align-items: center;
    gap: 6.4px;
}

.p-bunnyquery .bq-demo-bubble p {
    margin: 0 0 9.6px;
}

.p-bunnyquery .bq-demo-bubble p:last-child {
    margin: 0;
}

.p-bunnyquery .bq-demo-table {
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0 0 9.6px;
    font-size: 12.8px;
}

.p-bunnyquery .bq-demo-table th,
.p-bunnyquery .bq-demo-table td {
    border: 1px solid var(--bq-line);
    padding: 4.8px 9.6px;
    text-align: left;
}

.p-bunnyquery .bq-demo-table th {
    background: var(--bq-alt-bg);
    font-weight: 600;
}

.p-bunnyquery .bq-demo-file {
    display: inline-block;
    padding: 4.8px 11.2px;
    border: 1px solid var(--bq-line);
    color: var(--bq-pink);
    font-size: 12.8px;
}

/* The per-file citation line under the table. */
.p-bunnyquery .bq-demo-sources {
    font-size: 11.52px;
    color: var(--bq-muted);
}

/* Filled folder glyph: an inline SVG of Material Symbols "folder" (FILL 1),
   at the icon font's 1.15em box. */
.p-bunnyquery .bq-demo-folder-icon {
    display: block;
    width: 1.15em;
    height: 1.15em;
    margin-right: 4px;
    fill: currentColor;
}

/* The typing caret, at the end of the question as it is written. */
.p-bunnyquery .bq-demo-caret {
    display: inline-block;
    width: 1px;
    height: 1.1em;
    margin-left: 2px;
    vertical-align: -0.18em;
    background: var(--bq-ink);
    animation: pbq-blink 1s steps(2) infinite;
}

/* The widget's dot-trail: ".", "..", "..." stepped, no fading. Always three
   dots wide, so whatever holds it keeps one width. */
.p-bunnyquery .bq-demo-dots {
    display: inline-block;
    min-width: calc(3ch + 0.6em);
    color: var(--bq-muted);
    letter-spacing: 0.2em;
    text-align: left;
}

.p-bunnyquery .bq-demo-dots::after {
    content: ".";
    animation: pbq-dots 1.2s steps(1) infinite;
}

.p-bunnyquery .bq-demo-note .bq-demo-dots {
    color: var(--bq-warning);
}

@keyframes pbq-blink {
    50% { opacity: 0; }
}

@keyframes pbq-dots {
    0%  { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
}

@media (prefers-reduced-motion: no-preference) {
    /* Each piece slides in as the script inserts it. The bunny's bubble is
       inserted once, when it starts thinking, and then only grows. */
    .p-bunnyquery .bq-demo-note,
    .p-bunnyquery .bq-demo-msg {
        animation: pbq-in 0.28s ease;
    }

    /* A line of the reply fades in where it lands (nothing on the table's
       rows: a fading row shows its borders before its text). */
    .p-bunnyquery .bq-demo-reply-p,
    .p-bunnyquery .bq-demo-sources,
    .p-bunnyquery .bq-demo-file {
        animation: pbq-fade 0.2s ease both;
    }
}

@keyframes pbq-fade {
    from { opacity: 0; }
}

@keyframes pbq-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* under the window and its plate */
.p-bunnyquery .bq-demo-caption {
    margin: 30.4px 0 0;
    color: var(--bq-muted);
    font-size: 14.08px;
    text-align: center;
}

/* ─── responsive ─── */
@media (max-width: 1000px) {
    /* The bunny's track already puts a jump's worth of air above the chat
       window, so the gap between the copy and the stage can be small. */
    .p-bunnyquery .bq-hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    /* One column: no clear corner left for the glyph field to sit in. */
    .p-bunnyquery::before {
        display: none;
    }

    /* stacked, the chat window is as wide as the old centred one */
    .p-bunnyquery .bq-hero-stage {
        width: 100%;
        max-width: 780px;
        margin: 0 auto;
    }
}

@media (max-width: 900px) {
    .p-bunnyquery .bq-wrap {
        padding: 0 24px;
    }

    .p-bunnyquery {
        padding: 36px 0 52px;
    }

    .p-bunnyquery .bq-demo-msg {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    /* the plate would push past the gutter */
    .p-bunnyquery .bq-demo-frame::before {
        inset: 8px -8px -8px 8px;
    }

    .p-bunnyquery .bq-hero-actions .bq-btn {
        display: block;
        width: 100%;
        text-align: center;
    }
}
