/* QubiAI panel ("Editorial"): a large title and a one-line lede, the two
   models as numbered entries split by a fine rule, then one real request and
   the circuit the engine drew for it. On wide screens the panel runs the full
   height of the three cards beside it. Scoped to .hqv6. */

.hqv6 {
    --h6-rule: rgba(167, 175, 214, 0.22);
    --h6-rule-strong: rgba(226, 232, 255, 0.75);
    --h6-num: #a78bfa;
    --h6-plate: #0a0a1a;
    --h6-plate-edge: rgba(139, 124, 246, 0.26);
    --h6-ask-bg: rgba(255, 255, 255, 0.03);
}

html[data-theme="light"] .hqv6 {
    --h6-rule: rgba(40, 50, 120, 0.16);
    --h6-rule-strong: #1e2748;
    --h6-num: #6d5ce8;
    --h6-plate: #ffffff;
    --h6-plate-edge: rgba(76, 64, 160, 0.2);
    --h6-ask-bg: rgba(40, 50, 120, 0.04);
}

/* The panel, its chamfered edge, and (wide screens) the full height of the row. */
.hqv6.tk-ai {
    align-self: stretch;
}

.hqv6 .h6-card {
    flex: 1 1 auto;
    display: flex;
    padding: 1px;
    background: var(--tk-edge);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%);
}

.hqv6 .h6-in {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 22px 26px 26px;
    background: linear-gradient(170deg, var(--tk-card) 0%, var(--tk-card-2) 100%);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%);
}

/* ── Masthead ────────────────────────────────────────────────────────── */

.hqv6 .h6-head {
    padding-bottom: 12px;
    border-bottom: 2px solid var(--h6-num);
}

.hqv6 .h6-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 3.4vw, 3.2rem);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: 0.005em;
    color: var(--tk-text);
}

.hqv6 .h6-lede {
    margin: 6px 0 0;
    font-family: var(--font-display);
    font-size: 1.03rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--tk-muted);
}

/* ── The two models ──────────────────────────────────────────────────── */

.hqv6 .h6-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-bottom: 1px solid var(--h6-rule);
}

.hqv6 .h6-entry {
    min-width: 0;
    padding: 16px 0 18px;
}

.hqv6 .h6-entry:first-child {
    padding-right: 22px;
}

.hqv6 .h6-entry + .h6-entry {
    padding-left: 22px;
    border-left: 1px solid var(--h6-rule);
}

.hqv6 .h6-num {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.14em;
    font-variant-numeric: tabular-nums;
    color: var(--h6-num);
}

.hqv6 .h6-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 2.7vw, 2.6rem);
    font-weight: 700;
    line-height: 1;
    color: var(--tk-text);
}

.hqv6 .h6-meta {
    margin: 6px 0 10px;
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: var(--h6-num);
}

/* One line each: 1rem, and a touch less where the column is narrowest. */
.hqv6 .h6-text {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.28;
    color: var(--tk-muted);
}

/* ── One request and its circuit ─────────────────────────────────────── */

@media (min-width: 1280px) and (max-width: 1365.98px) {
    .hqv6 .h6-text {
        font-size: 0.94rem;
    }
}

.hqv6 .h6-fig {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 18px 0 0;
    min-height: 0;
}

.hqv6 .h6-ask {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--h6-plate-edge);
    border-radius: 8px;
    background: var(--h6-ask-bg);
    font-family: var(--font-display);
    font-size: 1.12rem;
    line-height: 1.2;
    color: var(--tk-text);
}

/* A fixed box, the word centred in it both ways. The padding is measured: the
   glyphs sit a little high and right in their line box, and text snaps to whole
   pixels, so 2px on top is the most even across screen densities. */
.hqv6 .h6-ask-tag {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 2px 6.6px 0 7.4px;
    border-radius: 4px;
    background: var(--h6-num);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tk-card, #0b0d1f);
}

/* Light mode: a black outline with black text. */
html[data-theme="light"] .hqv6 .h6-ask-tag {
    border: 1px solid #111;
    background: transparent;
    color: #111;
}

/* This display face draws its capitals high in the line box; 2px down puts
   them on the row's centre line, level with the ASK badge (measured). */
.hqv6 .h6-ask-q {
    min-width: 0;
    transform: translateY(2px);
}

.hqv6 .h6-plate {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    min-height: 190px;
    padding: 12px;
    border: 1px solid var(--h6-plate-edge);
    border-radius: 8px;
    background: var(--h6-plate);
    overflow: hidden;
}

/* The circuit, drawn like the home page's other circuits (js/viz-circuit.js). */
.hqv6 .h6-plate .viz-circuit {
    display: block;
    width: min(100%, 330px);
    height: auto;
}

html[data-theme="light"] .hqv6 .viz-wire { stroke: rgba(76, 64, 160, 0.5); }
html[data-theme="light"] .hqv6 .viz-label { fill: #334155; }
html[data-theme="light"] .hqv6 .viz-ctrl { stroke: #f4f5fc; }
html[data-theme="light"] .hqv6 .viz-meas { stroke: #fff; }

.hqv6 .h6-actions {
    margin-top: 18px;
    flex-wrap: wrap;
}

/* ── Full-width row (992 to 1279): the title and models on the left, the request beside them. */

@media (min-width: 992px) and (max-width: 1279.98px) {
    .hqv6 .h6-in {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "head fig"
            "list fig"
            "list actions";
        column-gap: 32px;
    }

    .hqv6 .h6-head { grid-area: head; }
    .hqv6 .h6-list { grid-area: list; align-self: start; }
    .hqv6 .h6-fig { grid-area: fig; margin: 0; }
    .hqv6 .h6-actions { grid-area: actions; }

    .hqv6 .h6-plate {
        min-height: 170px;
    }
}

/* ── Phones: one column, the rule turns horizontal. ──────────────────── */

@media (max-width: 767.98px) {
    .hqv6 .h6-in {
        padding: 18px 16px 34px;
    }

    .hqv6 .h6-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .hqv6 .h6-entry:first-child {
        padding-right: 0;
    }

    .hqv6 .h6-entry + .h6-entry {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid var(--h6-rule);
    }

    .hqv6 .h6-ask {
        font-size: 1.02rem;
    }

    .hqv6 .h6-plate {
        min-height: 0;
        padding: 10px 6px;
    }

    .hqv6 .h6-plate .viz-circuit {
        width: min(100%, 280px);
    }

    .hqv6 .h6-actions .tk-btn {
        flex: 1 1 100%;
    }
}
