/* ============================================================
   tool-tryit.css — the "Test Drive" panel on /tool/<slug>
   (pass 017)

   Tokens only, from css/variables.css. The panel borrows the Forge's
   two-pane shape deliberately: picker on the left, live prompt in a
   terminal on the right, so the site's one "you can do something here"
   layout now also appears on the page that asks for the click.

   .pv-slot is re-declared at the bottom because the highlight markup is
   shared with prompt-view.php but its styles live in pages/prompts.css,
   which this page does not load.
   ============================================================ */

.ttd {
    margin-bottom: var(--space-8);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ── Head ───────────────────────────────────────────────── */
.ttd-head {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(255, 92, 53, 0.10), transparent 60%),
        var(--surface-2);
}

.ttd-eyebrow {
    margin: 0 0 var(--space-2);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-orange);
}

.ttd-title {
    margin: 0 0 var(--space-2);
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
}

.ttd-sub {
    margin: 0;
    max-width: 62ch;
    font-size: var(--text-base);
    color: var(--text-muted);
}

/* ── Body: picker + pane ────────────────────────────────── */
.ttd-body {
    display: grid;
    grid-template-columns: minmax(200px, 270px) 1fr;
    align-items: stretch;
}

.ttd-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3);
    border-right: 1px solid var(--border);
    background: var(--bg);
}

.ttd-tab {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    width: 100%;
    padding: var(--space-3);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-body);
    transition: background var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast);
}

.ttd-tab:hover { background: var(--surface-2); color: var(--text); }

.ttd-tab:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

.ttd-tab.is-on {
    background: var(--surface-2);
    border-color: var(--border-hover);
    color: var(--text);
}

.ttd-tab-n {
    flex: 0 0 auto;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    padding-top: 2px;
}

.ttd-tab.is-on .ttd-tab-n { color: var(--accent-orange); }

.ttd-tab-main { min-width: 0; }

.ttd-tab-t {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.35;
    color: inherit;
    /* Two lines, then ellipsis — titles in this library run long. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ttd-tab-m {
    display: block;
    margin-top: 3px;
    font-size: var(--text-xs);
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ttd-tab.is-on .ttd-tab-m { color: var(--text-muted); }

/* ── Pane ───────────────────────────────────────────────── */
.ttd-panes { min-width: 0; }

/* [hidden] is a UA rule of display:none at zero specificity, which the
   display:flex below silently beats — without this, all four panes render
   stacked down the page. */
.ttd-pane[hidden] { display: none; }

.ttd-pane {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5);
    min-width: 0;
}

/* Fill-in */
.ttd-fill {
    padding: var(--space-4);
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 2px solid var(--accent-orange);
    border-radius: var(--radius-md);
}

.ttd-fill-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}

.ttd-fill-lead {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text);
}

.ttd-fill-meter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.ttd-fill-meter b { color: var(--text); font-weight: 700; }

.ttd-fill-bar {
    display: block;
    width: 72px;
    height: 4px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.ttd-fill-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: var(--radius-pill);
    background: var(--grad-primary);
    transition: width var(--transition-base), background var(--transition-base);
}

.ttd-fill.is-complete .ttd-fill-bar i { background: var(--grad-green); }

.ttd-fill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--space-3);
}

.ttd-fill-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.ttd-fill-label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ttd-fill-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ttd-fill-input::placeholder { color: var(--text-faint); }

.ttd-fill-input:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(255, 92, 53, 0.15);
}

.ttd-fill-input.is-filled { border-color: rgba(0, 229, 122, 0.4); }

/* Terminal */
.ttd-term {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ttd-term-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 8px var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    font-size: var(--text-xs);
    color: var(--text-faint);
}

.ttd-term-file {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ttd-term-model {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-cyan);
    font-weight: 600;
}

.ttd-pre {
    margin: 0;
    padding: var(--space-4);
    max-height: 340px;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-sm);
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Actions */
.ttd-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.ttd-go {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 12px var(--space-5);
    border-radius: var(--radius-md);
    background: var(--grad-primary);
    /* Dark ink on the orange→yellow gradient: white is ~3.2:1 here and fails
       AA. Same fix pass 014 made to .btn-primary. */
    color: #1a0b06;
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-glow-orange);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.ttd-go:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 92, 53, 0.45);
    color: #1a0b06;
}

.ttd-go:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

.ttd-go.is-copied { background: var(--grad-green); box-shadow: none; }

.ttd-go-arrow { transition: transform var(--transition-fast); }
.ttd-go:hover .ttd-go-arrow { transform: translateX(3px); }

/* The secondary Run button. launchpad.js and shelf.inc.php both bind to
   .lp-run hosts, so it keeps that class and is only restyled — including
   .lp-run's orange gradient and glow, which would compete with the primary
   action beside it. The Shelf button injects itself right after this one and
   already matches: .shelf-add is the same height and surface. */
.ttd-run.lp-run {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 11px var(--space-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: none;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.ttd-run.lp-run:hover {
    border-color: var(--border-hover);
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.ttd-view {
    margin-left: auto;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.ttd-view:hover { color: var(--accent-orange); }

.ttd-foot {
    margin: 0;
    padding: var(--space-3) var(--space-6) var(--space-4);
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--text-faint);
}

.ttd-foot a { color: var(--text-muted); }

/* ── Slot highlights (shared markup, styles live in prompts.css) ── */
.ttd-pre .pv-slot {
    all: unset;
    display: inline;
    font-family: inherit;
    font-size: inherit;
    padding: 1px 5px;
    margin: 0 -1px;
    border-radius: 4px;
    background: rgba(255, 184, 0, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 184, 0, 0.3);
    color: var(--accent-yellow);
    font-weight: 600;
    transition: background var(--transition-fast), color var(--transition-fast),
                box-shadow var(--transition-fast);
}

.ttd-pre .pv-slot.is-filled {
    background: rgba(0, 229, 122, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 229, 122, 0.35);
    color: var(--text);
}

.ttd-pre .pv-slot.is-active {
    background: rgba(255, 92, 53, 0.16);
    box-shadow: inset 0 0 0 1px var(--accent-orange);
    color: var(--text);
}

.ttd-pre .prompt-ext-link { color: var(--accent-cyan); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
    .ttd-body { grid-template-columns: 1fr; }

    .ttd-tabs {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
    }
    .ttd-tabs::-webkit-scrollbar { display: none; }

    .ttd-tab {
        flex: 0 0 auto;
        width: auto;
        max-width: 230px;
        border-color: var(--border);
        background: var(--surface);
    }
}

@media (max-width: 560px) {
    .ttd-head { padding: var(--space-4); }
    .ttd-title { font-size: var(--text-xl); }
    .ttd-pane { padding: var(--space-4); }
    .ttd-fill-grid { grid-template-columns: 1fr; }
    .ttd-actions { gap: var(--space-2); }
    .ttd-go { width: 100%; justify-content: center; }
    .ttd-run.lp-run { flex: 1 1 auto; justify-content: center; }
    .ttd-view { margin-left: 0; }
    .ttd-foot { padding: var(--space-3) var(--space-4) var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
    .ttd-go, .ttd-go-arrow, .ttd-fill-bar i, .ttd-pre .pv-slot { transition: none; }
    .ttd-go:hover { transform: none; }
}
